wannacry Posted July 13, 2017 Share Posted July 13, 2017 I just made a script, This script effects everyone. I just want the "Staff" team not to be effected from this script. What should I do to remove the "staff" team from this script? -- List of commands to disable cmdList = { ["speaker"]=true, ["superman"]=true, } -- Disable unwanted commands addEventHandler("onPlayerCommand", root, function(cmdName) if cmdList[cmdName] then cancelEvent() end end) Link to comment
AHMED MOSTAFA Posted July 13, 2017 Share Posted July 13, 2017 Just now, wannacry said: I just made a script, This script effects everyone. I just want the "Staff" team not to be effected from this script. What should I do to remove the "staff" team from this script? -- List of commands to disable cmdList = { ["speaker"]=true, ["superman"]=true, } -- Disable unwanted commands addEventHandler("onPlayerCommand", root, function(cmdName) if cmdList[cmdName] then cancelEvent() end end) test it commandList = { ["speaker"]=true, ["superman"]=true, } function onCommand ( command ) if commandList [ command ] and not ( getTeamName ( getPlayerTeam ( source ) ) == "Staff" ) then cancelEvent() end end addEventHandler("onPlayerCommand", root, onCommand ) Link to comment
koragg Posted July 13, 2017 Share Posted July 13, 2017 Or if you have a 'Staff' acl group then use this: -- List of commands to disable cmdList = { ["speaker"]=true, ["superman"]=true, } -- Disable unwanted commands function onPlayerCommand(cmdName) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("Staff")) then return end if cmdList[cmdName] then cancelEvent() end end addEventHandler("onPlayerCommand", root, onPlayerCommand) Link to comment
wannacry Posted July 13, 2017 Author Share Posted July 13, 2017 6 minutes ago, Killer Project said: test it commandList = { ["speaker"]=true, ["superman"]=true, } function onCommand ( command ) if commandList [ command ] and not ( getTeamName ( getPlayerTeam ( source ) ) == "Staff" ) then cancelEvent() end end addEventHandler("onPlayerCommand", root, onCommand ) Oh yeah, It works. Thanks for helping. Link to comment
AHMED MOSTAFA Posted July 13, 2017 Share Posted July 13, 2017 Just now, wannacry said: Oh yeah, It works. Thanks for helping. your welcome Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now