dex. Posted October 21, 2017 Share Posted October 21, 2017 Hey. I have little issue with adding two text to script What i wanna do is If Admin writes /duty then scripts says outchatbox for everyone "Admin is on duty" and if Admin writes again /duty then then scripts says outchatbox for everyone "Admin is off duty" script: function duty(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then setTimer ( function() setElementData (thePlayer, "brokenbone", false) setElementData (thePlayer, "bleeding", false) setElementData (thePlayer, "pain", false) setElementData (thePlayer, "cold", false) setElementData (thePlayer, "temperature", 36.5) setElementData (thePlayer, "blood", 12000) setElementData (thePlayer, "food", 100) setElementData (thePlayer, "thirst", 75) end, 50,0) end end addCommandHandler("duty", duty) Link to comment
ShayF2 Posted October 22, 2017 Share Posted October 22, 2017 (edited) local onDuty = {} addCommandHandler('duty',function(player,cmd) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup('user.'..accName,aclGetGroup('Admin')) then if not onDuty[player] or onDuty[player] == false then onDuty[player] = true outputChatBox(getPlayerName(player)..' is now on duty!',root) local timer1 = setTimer(function() setElementData(player,'brokenbone',false) setElementData(player,'bleeding',false) setElementData(player,'pain',false) setElementData(player,'cold',false) setElementData(player,'temperature',36.5) setElementData(player,'blood',12000) setElementData(player,'food',100) setElementData(player,'thirst',75) end,50,0) else onDuty[player] = false outputChatBox(getPlayerName(player)..' is now off duty!',root) if isTimer(timer1) then killTimer(timer1) end end end end) Edited October 22, 2017 by ShayF Link to comment
dex. Posted October 23, 2017 Author Share Posted October 23, 2017 Thats very nice, but theres is a one problem, script dosen't kill timer after offduty... Link to comment
ShayF2 Posted October 24, 2017 Share Posted October 24, 2017 WELL SINCE THE DANG FLABBIN TIMER DOESN'T WANNA DIE, I WANT SOME FRIGGIN CARDBOARD MY BRUTHA. GOT SOME CARDBOARD I CAN BORRA FOR A MIN? I NEED SOME CARDBOARD FOR MY COMPUTER SO THAT IT CAN PRINT MORE CARDBOARD SO THAT I CAN WIPE MY BOOTY IN DA MORNIN... Link to comment
Rockyz Posted October 24, 2017 Share Posted October 24, 2017 remove 'local' at line 9 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