Gravestone Posted May 9, 2016 Share Posted May 9, 2016 I made this code to add a VIP account for 1 week. The timer should start when the object is added. To test, I set the timer to 1 second. The object doesn't get removed. Any help guys? function addVIP (playerSource, commandName, accountName, type) if accountName then aclGroupAddObject (aclGetGroup("VIP"), "user."..accountName) outputChatBox ("Account '"..accountName.."' has been succesfully made VIP (3 Weeks)", playerSource) setTimer(removeVIP, 1000, 1) else outputChatBox ("No account name specified.", playerSource) outputChatBox ("Correct syntax: /giveVIP [Account Name]", playerSource) end end addCommandHandler ("giveVIP", addVIP) --ad The removing code: function removeVIP (accountName) aclGroupRemoveObject (aclGetGroup("VIP"), "user."..accountName) outputServerLog("Account "..accountName.."'s VIP expired.") end For this, error in debugscript: attempt to concatenate local 'accountName' (a nil value) Link to comment
Walid Posted May 9, 2016 Share Posted May 9, 2016 You need to add the arg here: Try this : function addVIP (playerSource, commandName, accountName, type) if player and isElement(player) then if accountName then aclGroupAddObject (aclGetGroup("VIP"), "user."..accountName) outputChatBox ("Account '"..accountName.."' has been succesfully made VIP (3 Weeks)", playerSource) setTimer(removeVIP, 1000, 1,accountName) else outputChatBox ("No account name specified.", playerSource) outputChatBox ("Correct syntax: /giveVIP [Account Name]", playerSource) end end end addCommandHandler ("giveVIP", addVIP) function removeVIP (accountName) if accountName then aclGroupRemoveObject (aclGetGroup("VIP"), "user."..accountName) outputServerLog("Account "..accountName.."'s VIP expired.") end end 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