Jump to content

set team


Gtagasje

Recommended Posts

hi.

I have made this script to set your team to Staff if you are in the admin ACL. But it shows this error: Attempt to concatenate global 'playerName'. (A nill value). Its on line :4:. I dont know how to fix this. I tried, but without succes. But the getACL thing is working in other scripts. What to do..

This is my script (server):

  
local Staff = createTeam ( "Staff", 113, 0, 188 ) 
  
function StaffTeam ( source, command ) 
  if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then 
    setPlayerTeam (source, "Staff") 
    else 
    cancelEvent() 
  end 
end 
addCommandHandler("admin", StaffTeam) 
  

Link to comment
local Staff = createTeam ( "Staff", 113, 0, 188 ) 
  
function StaffTeam ( source, command ) 
local playerName = getPlayerAccount(source) 
  if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then 
    setPlayerTeam (source, "Staff") 
    else 
    cancelEvent(true, "You're not allowed to use this command!") 
  end 
end 
addCommandHandler("admin", StaffTeam) 

?

Link to comment
hi.

I have made this script to set your team to Staff if you are in the admin ACL. But it shows this error: Attempt to concatenate global 'playerName'. (A nill value). Its on line :4:. I dont know how to fix this. I tried, but without succes. But the getACL thing is working in other scripts. What to do..

This is my script (server):

  
local Staff = createTeam ( "Staff", 113, 0, 188 ) 
  
function StaffTeam ( source, command ) 
  if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then 
    setPlayerTeam (source, "Staff") 
    else 
    cancelEvent() 
  end 
end 
addCommandHandler("admin", StaffTeam)  

Don't mind CapY.. He is a little slow..

You are forgetting to define playerName anywhere in your script.

You need:

 local playerName = getPlayerName(source) 
  

You also want to do is remove ' "" ' from "Staff" - So:

 -- This should be changed 
setPlayerTeam (source, "Staff") 
-- To this 
setPlayerTeam (source, Staff) 

And just before the end, I dont see a reason to use cancelEvent(), in your case, because if the user is not in the Staff group, then nothing will happen.

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