kolpo 1 Posted December 23, 2012 For example I want the use of this: onMapSingleClick "hint 'This action has a 5 second cooldown'"; To have a 5 seconds delay. Once you activate it can't you activate it again for 5 seconds Share this post Link to post Share on other sites
tryteyker 28 Posted December 23, 2012 Remove the action at the start of the script (incase you use addAction) and add a sleep of 5 secs (sleep 5) to the end before adding the action again. Share this post Link to post Share on other sites
Horner 13 Posted December 23, 2012 Cooldown = 0; player addAction ["Action","script.sqf",[],1,true,true,"","Cooldown < 1"]; In script.sqf Cooldown = 1; //Your code sleep 5; Cooldown = 0; Share this post Link to post Share on other sites
kolpo 1 Posted December 24, 2012 Thank you, with what you suggested as a basis have I come up with something that does what I want to do: On player unit init : cooldown=0; onMapSingleClick "If (_alt) then { temp = execVM 'cooldown.sqf'}"; cooldown.sqf: if (cooldown<1) then {hint "allowed";cooldown = 1; sleep 5; cooldown=0} Share this post Link to post Share on other sites
kolpo 1 Posted December 24, 2012 (edited) EDIT: I found an answer myself to my second question, I think this shall let it work with more then 1 player. I shall ask a friend to test it with me later online to make sure it works: On each playable unit init : this setVariable ["cooldown", 0, false]; onMapSingleClick "If (_alt) then { temp = execVM 'cooldown.sqf'}"; cooldown.sqf: if (player getVariable "cooldown"<1) then {hint "allowed";player setVariable ["cooldown", 1, false]; sleep 5; player setVariable ["cooldown", 0, false];} Edited December 24, 2012 by kolpo Share this post Link to post Share on other sites