Jump to content

permission to use command


Gallagher

Recommended Posts

Hello friends!

I wonder how do I ensure that only members of a group can enter this command addCommandHandler ("test", openMyGate).

There is a group in acl, is a group of dayz, gangsystem.

example: group name "survivors" if the player is the group opens the gate if it is not a message appears, "You are not of this clan"

Thanks

  
function createTheGate () 
          
         myGate1 = createObject ( 2435, 2434.75488, -1380.33496, 22.10521, 0, 0, 269.995 ) 
         myGate2 = createObject ( 2435, 2427.05176, -1380.25488, 22.10521, 0, 0, 269.995 ) 
     
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
---- Base  ---- 
 function openMyGate ( ) 
 moveObject ( myGate1, 4000, 2437.8999, -1380.19995, 22.1 ) 
 moveObject ( myGate2, 4000, 2424.1001, -1380.40002, 22.1 ) 
 end 
 addCommandHandler("test",openMyGate) 
   
 function movingMyGateBack () 
 moveObject ( myGate1, 4000, 2434.75488, -1380.33496, 22.10521 ) 
 moveObject ( myGate2, 4000, 2427.05176, -1380.25488, 22.10521 ) 
 end 
 addCommandHandler("testclose",movingMyGateBack) 
  

Link to comment
  
      
    function createTheGate () 
              
             myGate1 = createObject ( 2435, 2434.75488, -1380.33496, 22.10521, 0, 0, 269.995 ) 
             myGate2 = createObject ( 2435, 2427.05176, -1380.25488, 22.10521, 0, 0, 269.995 ) 
        
          end 
      
          addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
      
    ---- Base  ---- 
     function openMyGate () 
    local thePlayer = source 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Survivors" ) ) then 
     moveObject ( myGate1, 4000, 2437.8999, -1380.19995, 22.1 ) 
     moveObject ( myGate2, 4000, 2424.1001, -1380.40002, 22.1 ) 
     else 
        outputChatBox("You're not in the Survivors Group!", thePlayer, 125, 0, 0, false) 
     end 
     end 
     addCommandHandler("test",openMyGate) 
      
     function movingMyGateBack () 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Survivors" ) ) then 
     moveObject ( myGate1, 4000, 2434.75488, -1380.33496, 22.10521 ) 
     moveObject ( myGate2, 4000, 2427.05176, -1380.25488, 22.10521 ) 
     else 
     outputChatBox("You're not in the Survivors Group!", thePlayer, 125, 0, 0, false) 
     end 
     end 
     addCommandHandler("testclose",movingMyGateBack) 
      

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...