Page 3 of 3 FirstFirst 1 2 3
Results 21 to 29 of 29

Thread: Check if player is staff + add a rank

  1. #21
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by Joe View Post
    Another problem, why that don't work with thiso.catchevent:
    PHP Code:
    this.join("staffmembers");

    function 
    onActionServerSide(tooltabs) {
      if(
    staffMembers(player.account))
      {
        if(
    isStaffMember(player.account)[0])
        {
          echo(
    "Staff Tools gave to:");
          echo(
    player.account);
          for (
    temp.0tooltabs.size(); i++)
          {
            if(
    isStaffMember(player.account)[1] >= tooltabs[i][4])
            {
              
    player.addweapon(tooltabs[i][2]);
            }
            else{
              
    player.removeweapon(tooltabs[i][2]);
            }
          }
        }
      }
    }

    //#CLIENTSIDE

    function onCreated()
    {
      
    //Array: Id, Name, Weapon, Image, Rank Needed
      
    this.stafftool = {
        {
    0,"Boots","-Staff/Boots","boots",1},
        {
    1,"Stick","-Staff/Stick","stick",1},
        {
    2,"Drag","-Staff/Drag","drag",1},
        {
    3,"Stealth","-Staff/Stealth","stealth",1},
        {
    4,"StaffCmd","-Staff/Cmd","staffcmd",1},
        {
    5,"StaffEffects","-Staff/Effects","staffeffect",1},
        {
    6,"StaffTag","-Staff/Tag","stafftag",1},
        {
    7,"TileEditor","-Staff/TileEditor","tileeditor",8},
        {
    8,"NpcEditor","-Staff/NPCEditor","npceditor",9},
        {
    9,"SQLEditor","-Staff/SQLExplorer","sqleditor",10}
      };

      
    //Add Tools to Staff
      //triggerserver("weapon", this.name, this.stafftool);

      //Show Staff Tools Window
      
    showStaffToolWindow(this.stafftool);
    }


    function 
    showStaffToolWindow(stafftooltabs){
      
    //Echo Window
      
    StaffToolsWindow.show();
        new 
    GuiControl("StaffToolsWindow") {
          
    wSTW screenwidth 100;
          
    useownprofile true;
          
    profile.opaque true;
          
    profile.border 1;
          
    profile.borderColor "0 0 0";
          
    profile.fillColor "57 57 57";
          
    extent   "100 405";
          
    position = {wSTW,0};
          
    canMove true;
          
    canResize canMaximize canClose false;
          
    alpha .8;

          new 
    GuiControl("StaffToolsWindowTitle") {
            
    useownprofile true;
            
    profile.opaque true;
            
    profile.border 1;
            
    profile.borderColor "0 0 0";
            
    profile.fillColor "37 37 37";
            
    position "0 0";
            
    extent "100 40";
            
    canResize canMaximize canClose canMove false;

            new 
    GuiTextCtrl("StaffToolsWindowTitleText") {
              
    useownprofile true;
              
    profile.fontColor "255 255 255";
              
    profile.fontSize 16;
              
    profile.justify "center";
              
    position "0 10";
              
    width 100;
              
    height 20;
              
    text "Staff Tools";
            }
          }
          
    paramsY 15;
          for (
    temp.0stafftooltabs.size(); i++)
          {
            
    paramsY += 35;

            new 
    GuiButtonCtrl("StaffToolsWindowButton_" stafftooltabs[i][3]) {
              
    profile GuiBlueButtonProfile;
              
    10;
              
    paramsY;
              
    width 80;
              
    height 30;
              
    text stafftooltabs[i][1];
              
    getID stafftooltabs[i][0];
              
    getWeapon stafftooltabs[i][2];
              
    thiso.catchevent(this"onAction""onToolsButtonAction");
            }
          }
        }
        
    //Window End
    }


    function 
    onToolsButtonAction(obj,stafftool)
    {
      for (
    temp.0stafftool.size(); i++)
      {
        if(
    stafftool[i][0] == obj.getID)
        {
          if((
    obj.getWeapon).isOpen()){
            
    player.chat obj.text SPC ": On";
            (
    obj.getWeapon).close();
          }
          else{
            
    player.chat obj.text SPC ": Off";
            (
    obj.getWeapon).open();
          }
        }
      }

    Is the function getting triggered? Try with basic player.chat etc. if not, then the problem is with the function naming. If it is being triggered, the problem is from the ifs() you got.

    BTW use this.stafftool not the param stafftool in the function. catchevent() only gives you one param which is the GUI.
    Last edited by Ventus; 03-18-2014 at 07:23 PM. Reason: Merged posts
    -Johnaudi

  2. #22
    Soldier
    Join Date
    Jun 2013
    Location
    France
    Posts
    55
    Ty, but now idk why my public function isOpen, open and close don't work for each staff weapon (all public function are inside the staff weapon):
    That don't work:
    PHP Code:
    this.join("staffmembers");

    function 
    onActionServerSide(tooltabs) {
      if(
    staffMembers(player.account))
      {
        if(
    isStaffMember(player.account)[0])
        {
          echo(
    "Staff Tools gave to:");
          echo(
    player.account);
          for (
    temp.0tooltabs.size(); i++)
          {
            if(
    isStaffMember(player.account)[1] >= tooltabs[i][4])
            {
              
    player.addweapon(tooltabs[i][2]);
            }
            else{
              
    player.removeweapon(tooltabs[i][2]);
            }
          }
        }
      }
    }

    //#CLIENTSIDE

    function onCreated()
    {
      
    //Array: Id, Name, Weapon, Image, Rank Needed
      
    this.stafftool = {
        {
    0,"Boots","-Staff/Boots","boots",1},
        {
    1,"Stick","-Staff/Stick","stick",1},
        {
    2,"Drag","-Staff/Drag","drag",1},
        {
    3,"Stealth","-Staff/Stealth","stealth",1},
        {
    4,"StaffCmd","-Staff/Cmd","staffcmd",1},
        {
    5,"StaffEffects","-Staff/Effects","staffeffect",1},
        {
    6,"StaffTag","-Staff/Tag","stafftag",1},
        {
    7,"TileEditor","-Staff/TileEditor","tileeditor",8},
        {
    8,"NpcEditor","-Staff/NPCEditor","npceditor",9},
        {
    9,"SQLEditor","-Staff/SQLExplorer","sqleditor",10}
      };

      
    //Add Tools to Staff
      //triggerserver("weapon", this.name, this.stafftool);

      //Show Staff Tools Window
      
    showStaffToolWindow(this.stafftool);
    }


    function 
    showStaffToolWindow(stafftooltabs){
      
    //Echo Window
      
    StaffToolsWindow.show();
        new 
    GuiControl("StaffToolsWindow") {
          
    wSTW screenwidth 100;
          
    useownprofile true;
          
    profile.opaque true;
          
    profile.border 1;
          
    profile.borderColor "0 0 0";
          
    profile.fillColor "57 57 57";
          
    extent   "100 405";
          
    position = {wSTW,0};
          
    canMove true;
          
    canResize canMaximize canClose false;
          
    alpha .8;

          new 
    GuiControl("StaffToolsWindowTitle") {
            
    useownprofile true;
            
    profile.opaque true;
            
    profile.border 1;
            
    profile.borderColor "0 0 0";
            
    profile.fillColor "37 37 37";
            
    position "0 0";
            
    extent "100 40";
            
    canResize canMaximize canClose canMove false;

            new 
    GuiTextCtrl("StaffToolsWindowTitleText") {
              
    useownprofile true;
              
    profile.fontColor "255 255 255";
              
    profile.fontSize 16;
              
    profile.justify "center";
              
    position "0 10";
              
    width 100;
              
    height 20;
              
    text "Staff Tools";
            }
          }
          
    paramsY 15;
          for (
    temp.0stafftooltabs.size(); i++)
          {
            
    paramsY += 35;

            new 
    GuiButtonCtrl("StaffToolsWindowButton_" stafftooltabs[i][3]) {
              
    profile GuiBlueButtonProfile;
              
    10;
              
    paramsY;
              
    width 80;
              
    height 30;
              
    text stafftooltabs[i][1];
              
    getID stafftooltabs[i][0];
              
    getWeapon stafftooltabs[i][2];
              
    thiso.catchevent(this"onAction""onToolsButtonAction");
            }
          }
        }
        
    //Window End
    }


    function 
    onToolsButtonAction(obj)
    {
      for (
    temp.0this.stafftool.size(); i++)
      {
        if(
    this.stafftool[i][0] == obj.getID)
        {
          if((
    obj.getWeapon).isOpen()){
            
    player.chat obj.text SPC ": Off";
            (
    obj.getWeapon).close();
          }
          else{
            
    player.chat obj.text SPC ": On";
            (
    obj.getWeapon).open();
          }
        }
      }

    and idk why it don't work because obj.getWeapon return the right weapon name, so everything should work :/

  3. #23
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by Joe View Post
    Ty, but now idk why my public function isOpen, open and close don't work for each staff weapon (all public function are inside the staff weapon):
    That don't work:
    PHP Code:
    this.join("staffmembers");

    function 
    onActionServerSide(tooltabs) {
      if(
    staffMembers(player.account))
      {
        if(
    isStaffMember(player.account)[0])
        {
          echo(
    "Staff Tools gave to:");
          echo(
    player.account);
          for (
    temp.0tooltabs.size(); i++)
          {
            if(
    isStaffMember(player.account)[1] >= tooltabs[i][4])
            {
              
    player.addweapon(tooltabs[i][2]);
            }
            else{
              
    player.removeweapon(tooltabs[i][2]);
            }
          }
        }
      }
    }

    //#CLIENTSIDE

    function onCreated()
    {
      
    //Array: Id, Name, Weapon, Image, Rank Needed
      
    this.stafftool = {
        {
    0,"Boots","-Staff/Boots","boots",1},
        {
    1,"Stick","-Staff/Stick","stick",1},
        {
    2,"Drag","-Staff/Drag","drag",1},
        {
    3,"Stealth","-Staff/Stealth","stealth",1},
        {
    4,"StaffCmd","-Staff/Cmd","staffcmd",1},
        {
    5,"StaffEffects","-Staff/Effects","staffeffect",1},
        {
    6,"StaffTag","-Staff/Tag","stafftag",1},
        {
    7,"TileEditor","-Staff/TileEditor","tileeditor",8},
        {
    8,"NpcEditor","-Staff/NPCEditor","npceditor",9},
        {
    9,"SQLEditor","-Staff/SQLExplorer","sqleditor",10}
      };

      
    //Add Tools to Staff
      //triggerserver("weapon", this.name, this.stafftool);

      //Show Staff Tools Window
      
    showStaffToolWindow(this.stafftool);
    }


    function 
    showStaffToolWindow(stafftooltabs){
      
    //Echo Window
      
    StaffToolsWindow.show();
        new 
    GuiControl("StaffToolsWindow") {
          
    wSTW screenwidth 100;
          
    useownprofile true;
          
    profile.opaque true;
          
    profile.border 1;
          
    profile.borderColor "0 0 0";
          
    profile.fillColor "57 57 57";
          
    extent   "100 405";
          
    position = {wSTW,0};
          
    canMove true;
          
    canResize canMaximize canClose false;
          
    alpha .8;

          new 
    GuiControl("StaffToolsWindowTitle") {
            
    useownprofile true;
            
    profile.opaque true;
            
    profile.border 1;
            
    profile.borderColor "0 0 0";
            
    profile.fillColor "37 37 37";
            
    position "0 0";
            
    extent "100 40";
            
    canResize canMaximize canClose canMove false;

            new 
    GuiTextCtrl("StaffToolsWindowTitleText") {
              
    useownprofile true;
              
    profile.fontColor "255 255 255";
              
    profile.fontSize 16;
              
    profile.justify "center";
              
    position "0 10";
              
    width 100;
              
    height 20;
              
    text "Staff Tools";
            }
          }
          
    paramsY 15;
          for (
    temp.0stafftooltabs.size(); i++)
          {
            
    paramsY += 35;

            new 
    GuiButtonCtrl("StaffToolsWindowButton_" stafftooltabs[i][3]) {
              
    profile GuiBlueButtonProfile;
              
    10;
              
    paramsY;
              
    width 80;
              
    height 30;
              
    text stafftooltabs[i][1];
              
    getID stafftooltabs[i][0];
              
    getWeapon stafftooltabs[i][2];
              
    thiso.catchevent(this"onAction""onToolsButtonAction");
            }
          }
        }
        
    //Window End
    }


    function 
    onToolsButtonAction(obj)
    {
      for (
    temp.0this.stafftool.size(); i++)
      {
        if(
    this.stafftool[i][0] == obj.getID)
        {
          if((
    obj.getWeapon).isOpen()){
            
    player.chat obj.text SPC ": Off";
            (
    obj.getWeapon).close();
          }
          else{
            
    player.chat obj.text SPC ": On";
            (
    obj.getWeapon).open();
          }
        }
      }

    and idk why it don't work because obj.getWeapon return the right weapon name, so everything should work :/
    To trigger weapons, you need to have @ inbetween the parenthesis.

    E.g: (@ obj.getWeapon).open(); and (@ obj.getWeapon).close();

    Make sure it's a public function.
    -Johnaudi

  4. #24
    Soldier
    Join Date
    Jun 2013
    Location
    France
    Posts
    55
    Thank you much, it worked!
    Last edited by Joe; 03-18-2014 at 09:07 PM.

  5. #25
    Soldier
    Join Date
    Jun 2013
    Location
    France
    Posts
    55
    Idk what is the prob but it only works the time I'm on, when I disconnect and reconnect, it don't work anymore :O

  6. #26
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    You probably no longer have one of the weapons.
    -Johnaudi

  7. #27
    Soldier
    Join Date
    Jun 2013
    Location
    France
    Posts
    55
    I have all so idk why it don't work:
    (Found something: when I try to echo getWeapon it don't work :O it gave me no result :O)

    PHP Code:
    this.join("staffmembers");

    function 
    onActionServerSide(tooltabs) {
      if(
    staffMembers(player.account))
      {
        if(
    isStaffMember(player.account)[0])
        {
          echo(
    "Staff Tools gave to:");
          echo(
    player.account);
          for (
    temp.0tooltabs.size(); i++)
          {
            if(
    isStaffMember(player.account)[1] >= tooltabs[i][4])
            {
              
    player.addweapon(tooltabs[i][2]);
            }
            else{
              
    player.removeweapon(tooltabs[i][2]);
            }
          }
        }
      }
    }

    //#CLIENTSIDE

    function onCreated()
    {
      
    //Array: Id, Name, Weapon, Image, Rank Needed
      
    this.stafftool = {
        {
    0,"Boots","-Staff/Boots","boots",1},
        {
    1,"Stick","-Staff/Stick","stick",1},
        {
    2,"Drag","-Staff/Drag","drag",1},
        {
    3,"Stealth","-Staff/Stealth","stealth",1},
        {
    4,"StaffCmd","-Staff/Cmd","staffcmd",1},
        {
    5,"StaffEffects","-Staff/Effects","staffeffect",1},
        {
    6,"StaffTag","-Staff/Tag","stafftag",1},
        {
    7,"TileEditor","-Staff/TileEditor","tileeditor",8},
        {
    8,"NpcEditor","-Staff/NPCEditor","npceditor",9},
        {
    9,"SQLEditor","-Staff/SQLExplorer","sqleditor",10}
      };

      
    //Add Tools to Staff
      //triggerserver("weapon", this.name, this.stafftool);

      //Show Staff Tools Window
      
    showStaffToolWindow(this.stafftool);
    }


    function 
    showStaffToolWindow(stafftooltabs){
      
    //Echo Window
      
    StaffToolsWindow.show();
        new 
    GuiControl("StaffToolsWindow") {
          
    wSTW screenwidth 100;
          
    useownprofile true;
          
    profile.opaque true;
          
    profile.border 1;
          
    profile.borderColor "0 0 0";
          
    profile.fillColor "57 57 57";
          
    extent   "100 405";
          
    position = {wSTW,0};
          
    canMove true;
          
    canResize canMaximize canClose false;
          
    alpha .8;

          new 
    GuiControl("StaffToolsWindowTitle") {
            
    useownprofile true;
            
    profile.opaque true;
            
    profile.border 1;
            
    profile.borderColor "0 0 0";
            
    profile.fillColor "37 37 37";
            
    position "0 0";
            
    extent "100 40";
            
    canResize canMaximize canClose canMove false;

            new 
    GuiTextCtrl("StaffToolsWindowTitleText") {
              
    useownprofile true;
              
    profile.fontColor "255 255 255";
              
    profile.fontSize 16;
              
    profile.justify "center";
              
    position "0 10";
              
    width 100;
              
    height 20;
              
    text "Staff Tools";
            }
          }
          
    paramsY 15;
          for (
    temp.0stafftooltabs.size(); i++)
          {
            
    paramsY += 35;

            new 
    GuiButtonCtrl("StaffToolsWindowButton_" stafftooltabs[i][3]) {
              
    profile GuiBlueButtonProfile;
              
    10;
              
    paramsY;
              
    width 80;
              
    height 30;
              
    text stafftooltabs[i][1];
              
    getID stafftooltabs[i][0];
              
    getWeapon stafftooltabs[i][2];
              
    thiso.catchevent(this"onAction""onToolsButtonAction");
            }
          }
        }
        
    //Window End
    }


    function 
    onToolsButtonAction(obj)
    {
      for (
    temp.0this.stafftool.size(); i++)
      {
        if(
    this.stafftool[i][0] == obj.getID)
        {
          if((@ 
    obj.getWeapon).isOpen()){
            
    player.chat obj.text SPC ": Off";
            (@ 
    obj.getWeapon).close();
          }
          else{
            
    player.chat obj.getWeapon SPC ": On";
            (@ 
    obj.getWeapon).open();
          }
        }
      }

    Last edited by Joe; 03-19-2014 at 06:37 PM.

  8. #28
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Does player.chat = obj.getWeapon; return; does this do anything? on the onToolsButtonAction function.
    -Johnaudi

  9. #29
    Soldier
    Join Date
    Jun 2013
    Location
    France
    Posts
    55
    I told you yesterday, I fixed my prob by declaring the variable getWeapon with this.getWeapon then it works perfectly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •