DarkByte Posted January 8, 2016 Posted January 8, 2016 I made a command that sets a player to be on duty but it wont work. function duty (playerSource) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( playerSource ) ), aclGetGroup ( "Admin" ) ) setElementData(playerSource,"duty",true) outputChatBox("It works") else setElementData(playerSource,"duty",false) end end addCommandHandler("duty",duty)
Revolt Posted January 8, 2016 Posted January 8, 2016 function duty (playerSource) local acc = getPlayerAccount ( playerSource ) if (acc and not isGuestAccount(acc)) then if isObjectInACLGroup ( "user.".. getAccountName ( acc ), aclGetGroup ( "Admin" ) ) setElementData(playerSource,"duty",true) outputChatBox("It works", playerSource) else setElementData(playerSource,"duty",false) outputChatBox("You're not an Admin!", playerSource) end else outputChatBox("You're not logged it!", playerSource) end end addCommandHandler("duty",duty) Try this.
1LoL1 Posted January 8, 2016 Posted January 8, 2016 function duty (playerSource) local acc = getPlayerAccount ( playerSource ) if (acc and not isGuestAccount(acc)) then if isObjectInACLGroup ( "user.".. getAccountName ( acc ), aclGetGroup ( "Admin" ) ) setElementData(playerSource,"duty",true) outputChatBox("It works", playerSource) else setElementData(playerSource,"duty",false) outputChatBox("You're not an Admin!", playerSource) end else outputChatBox("You're not logged it!", playerSource) end end addCommandHandler("duty",duty) Try this. You forgot "then". if isObjectInACLGroup ("user.".. getAccountName (acc), aclGetGroup ("Admin")) then
DarkByte Posted January 8, 2016 Author Posted January 8, 2016 Works, but when i type duty 2nd time it wont set to false
Revolt Posted January 8, 2016 Posted January 8, 2016 function duty (playerSource) local acc = getPlayerAccount ( playerSource ) if (acc and not isGuestAccount(acc)) then if isObjectInACLGroup ( "user.".. getAccountName ( acc ), aclGetGroup ( "Admin" ) ) then setElementData(playerSource,"duty",not getElementData(playerSource,"duty")) else outputChatBox("You're not an Admin!", playerSource) end else outputChatBox("You're not logged it!", playerSource) end end addCommandHandler("duty",duty)
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