Tycka Posted November 10, 2016 Share Posted November 10, 2016 Hello, for example I have function like this: function HP ( ) setElementData(source, "HP", 100) end addEvent( "HP", true ) addEventHandler( "HP", getRootElement(),HP ) How to make that after this function is used, next time it can be used after 15minutes? (For every player individually) Link to comment
LoPollo Posted November 10, 2016 Share Posted November 10, 2016 (edited) is this what are you searching for? if all this stuff must be done serverside (as i think reading your example), simply create a table that stores all these timers that you handle on player connect/quit, if the function is clientside it's as easy as creating one timer clientside. Another way to do it if the function HP() you are calling is serverside is creating timers clientside, and then triggering the event fom the client instead of managing server-side all the timers that triggers the event. Hope i've been clear and understood what you mean. Edited November 10, 2016 by LoPollo Link to comment
1LoL1 Posted November 10, 2016 Share Posted November 10, 2016 (edited) 3 hours ago, Tycka said: Hello, for example I have function like this: function HP ( )setElementData(source, "HP", 100)end addEvent( "HP", true )addEventHandler( "HP", getRootElement(),HP ) How to make that after this function is used, next time it can be used after 15minutes? (For every player individually) function HP () setElementData(source, "HP", 100) end addEvent("HP", true) addEventHandler("HP", getRootElement(), HP) setTimer(HP, 900000, 0) or addEvent("HP", true) addEventHandler("HP", getRootElement(), function () setTimer(function() setElementData(source, "HP", 100) end, 900000, 0) end) But if you want to health then use "setElementHealth" Edited November 10, 2016 by 1LoL1 Link to comment
Army@1 Posted November 11, 2016 Share Posted November 11, 2016 hptimer=false function HP() if(hptimer==false) then setElementData(source, "HP", 100) hptimer=true else outputChatBox("Please wait atleast 15 minutes.", 255, 0, 0) setTimer(function() hptimer=false end, 15*60*1000, 1) end end addEvent("HP", true) addEventHandler("HP", getRootElement(), HP) 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