PSYKO_nz 42 Posted October 31, 2018 I've been googling for the last hour or so and I can't make heads or tails of the various ways to sort a cool down for an addaction that came up, I have tried a few but got nowhere. I'm very sorry to repost on the subject, but I'm a bit confused so, here is what I want to do... I want to add a cooldown (duh) to the following addaction. this addAction["<t color='#ff9900'>Skydive Altis!</t>", "ATM_airdrop\atm_airdrop.sqf",[],1,false,true,"","_this distance _target < 2, sunOrMoon > 0.5"]; the cooldown needs to only affect the person who fires the addaction so anybody can come and use it at any time but after they use it they have to wait 5 mins to use it again I want to keep this painfully simple, it has to work on a dedicated server and I want to avoid getting into any unnecessary scripting, simple is good in this case Share this post Link to post Share on other sites
pierremgi 4738 Posted October 31, 2018 this addAction [ "<t color='#ff9900'>Skydive Altis!</t>", { execVM "ATM_airdrop\atm_airdrop.sqf"; (_this select 0) setVariable ["ATMcoolDown",false,true]; uiSleep 15; (_this select 0) setVariable ["ATMcoolDown",true,true] }, [],1,false,true,"", "_this distance _target < 2 && sunOrMoon > 0.5 && _target getVariable ['ATMcooldown',true]" ]; for 5 minutes, replace sleep 15 by uiSleep 300 This way, the addAction is unavailable for all players after one activated it. If your aim is to let the addAction available for others, just remove the third param (true) in variables: (_this select 0) setVariable ["ATMcoolDown",false]; uiSleep 15; (_this select 0) setVariable ["ATMcoolDown",true]; Now, you have the choice. 1 Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted October 31, 2018 the basic structure of an execution cooldown/delay: if (diag_tickTime < (uiNamespace getVariable ['tag_cooldown',-1])) exitWith {}; _cooldown = 10; // cooldown duration in seconds uiNamespace setVariable ['tag_cooldown',(diag_tickTime + _cooldown)]; And a working example: player addAction [ 'Test', { if (diag_tickTime < (uiNamespace getVariable ['tag_cooldown',-1])) exitWith { hint (format ['Too soon! Please wait %1 more seconds.',(round ((uiNamespace getVariable ['tag_cooldown',-1]) - diag_tickTime))]); }; _cooldown = 10; // cooldown duration in seconds uiNamespace setVariable ['tag_cooldown',(diag_tickTime + _cooldown)]; hint 'Go!'; } ]; and applied to your case: this addAction [ "<t color='#ff9900'>Skydive Altis!</t>", { if (diag_tickTime < (uiNamespace getVariable ['tag_cooldown',-1])) exitWith { hint (format ['Too soon! Please wait %1 more seconds.',(round ((uiNamespace getVariable ['tag_cooldown',-1]) - diag_tickTime))]); }; _cooldown = 300; // cooldown duration in seconds uiNamespace setVariable ['tag_cooldown',(diag_tickTime + _cooldown)]; [] execVM "ATM_airdrop\atm_airdrop.sqf"; }, [], 1, false, true, "", "_this distance _target < 2" ]; Adjust the _cooldown number to the desired delay, in seconds. 3 Share this post Link to post Share on other sites