WiBox Posted August 3, 2018 Share Posted August 3, 2018 (edited) Hello, I'm trying to add a damageTimer as if the player was damaged last 20 second he can't use a specific command... damageTimer = {} function test() if ( isTimer(damageTimer) ) then killTimer(damageTimer) end setElementData(source, "damage", "yes") if ( getElementData(source,"damage") == "yes" ) then setElementData(source,"damage", "no") setTimer( function () removeCommandhandler("ldm") end end,15000,1) end addCommandhandler("ldm", LAJDM) end addEventHandler("onPlayerDamage", test) Well, it didn't work shamefully, but I just need to know where are my mistakes... Thanks. " No error in /debugscript 3 " Edited August 3, 2018 by SSKE Link to comment
Moderators IIYAMA Posted August 4, 2018 Moderators Share Posted August 4, 2018 Mistakes: 1. You didn't save your timer. + A timer isn't the same as table. 2. If you set the element data to "no" before you set the timer = it has no function at all. You might consider remove it. Link to comment
WiBox Posted August 4, 2018 Author Share Posted August 4, 2018 Can you fix it? Because I don't know how to do any of what you said .. Link to comment
SycroX Posted August 4, 2018 Share Posted August 4, 2018 damageTimer = {} addEventHandler("onPlayerDamage", root, function() if not isTimer(damageTimer[source]) then removeCommandHandler("ldm") damageTimer[source] = setTimer(function(source) damageTimer[source] = nil addCommandHandler("ldm") end, 20000, 1, source) end end ) Link to comment
WiBox Posted August 4, 2018 Author Share Posted August 4, 2018 Oh, I see. Thanks I appreciate that Link to comment
SycroX Posted August 4, 2018 Share Posted August 4, 2018 32 minutes ago, SSKE said: Oh, I see. Thanks I appreciate that np 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