Jump to content

Command restriction


Recommended Posts

is there a way to restrict a command to only some people? we have our group of admins in our server but we often have to keep some commands secret, such as the opening of our gates at area 51 becasue we do not know how to restritct them. this question comes up becasue I have a perfect jail script, but this absolutley cannot be accessbile to anyone. how might i go about restricting the usage to admins only? just fyi, i do not own the server, i am a scripter for it, so it has to be a way that i can do it without editing the servers files.

here is an example of the script i want to restrict.

function jailPlayer(thePlayer, commandName, jailTarget) 
    theNoob = getPlayerFromNick(jailTarget) 
     
  
    
     
    if (theNoob) then 
        setElementInterior ( theNoob, 10 ) 
        setElementPosition (theNoob, 215.24324035645, 110.02223205566, 999.015625) 
        setElementDimension ( theNoob, 10 ) 
        toggleAllControls ( theNoob, false ) 
        outputChatBox ( "You have been jailed", theNoob, 193, 13, 13 ) 
        outputChatBox ( "You jailed a player", thePlayer, 193, 13, 13 ) 
         
    else 
        outputChatBox ("Error: This player doesn't exist", thePlayer, 193, 13, 13) 
    end 
  
     
  
end 
  
function unJail (thePlayer, commandName, jailTarget) 
     theNoob = getPlayerFromNick(jailTarget) 
      
      
      
  
     if (theNoob) then 
          setElementInterior ( theNoob, 0) 
          setElementPosition (theNoob, 2290.2666015625, 2431.1103515625, 10.8203125) 
          setElementDimension ( theNoob, 0 ) 
          toggleAllControls (theNoob, true) 
          outputChatBox ("You've been released, please behave next time", theNoob, 193, 13, 13) 
          outputChatBox ("You released a player", thePlayer, 193, 13, 13) 
  
     else 
          outputChatBox ("Error: This player doesn't exist", thePlayer, 193, 13, 13 ) 
  
     end     
end 
  
addCommandHandler("jail", jailPlayer) 
addCommandHandler("unjail", unJail ) 

Link to comment

You really have to use the ACL, that is what it is for. It's a matter of adding a line for each command in the admin group and specifying 'false' as the last argument for addCommandHandler for each of the commands you want to restrict.

Link to comment

I would modify it. im guessing i can just follow the format of the commands already there. we definatley need this. our secret commands keep leaking out to the public somehow lol. nobody says a word and everyone in the server can get into area 51. i had a look at the acl.xml and i notice a pattern. i think i understanf how to add commands to a group. is there a way to have it look for an admins nickname. or more likely how do i add someone to a group.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...