Jump to content
Sign in to follow this  
alleycat

I would like to delay something in the code

Recommended Posts

I created a script call when a player presses a key. Now I would like to prevent that from being called again until a certain amount of time has passed. Not sure how to do that.

Share this post


Link to post
Share on other sites

Create trigger (in the game editor) with name allowKey.

In the init field of this trigger write:

this execVM "yourScriptName.sqf";

Then create LUKI_time.sqf script and paste in this code:

_time = _this select 0;
allowKey = FALSE;

while { _time > 0 } do {
_time = _time - 1;

if ( _time == 0 ) exitWith {
hint "You can press the key again ...";
allowKey = TRUE;
 };

 sleep 60;
};

And you can call (for the example in the init.sqf) the script via this line:

[[color=#b22222][b][i]time (in minutes)[/i][/b][/color]] execVM "LUKI_time.sqf";

Edited by [CSLA]LUKI
mistake

Share this post


Link to post
Share on other sites

No problem, I'm glad to help you.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×