2015-01-17 05:58:24 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain
|
2015-01-17 05:58:24 +00:00
|
|
|
*
|
2015-05-21 16:42:44 +00:00
|
|
|
* Executes a code once with a given game ACE_time delay, using a PFH
|
2015-01-17 05:58:24 +00:00
|
|
|
*
|
|
|
|
* Argument:
|
2015-01-17 15:23:03 +00:00
|
|
|
* 0: Code to execute (Code)
|
2015-01-17 05:58:24 +00:00
|
|
|
* 1: Parameters to run the code with (Array)
|
|
|
|
* 2: Delay in seconds before executing the code (Number)
|
|
|
|
*
|
|
|
|
* Return value:
|
2015-05-26 03:46:56 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [{(_this select 0) setVelocity [0,0,200];}, [player], 10] call ace_common_fnc_waitAndExecute
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-17 05:58:24 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-26 03:46:56 +00:00
|
|
|
PARAMS_3(_func,_params,_delay);
|
2015-01-17 05:58:24 +00:00
|
|
|
|
2015-05-26 03:46:56 +00:00
|
|
|
GVAR(waitAndExecArray) pushBack [(ACE_time + _delay), _func, _params];
|
|
|
|
GVAR(waitAndExecArray) sort true;
|
2015-01-17 05:58:24 +00:00
|
|
|
|
2015-05-26 03:46:56 +00:00
|
|
|
if ((count GVAR(waitAndExecArray)) == 1) then {
|
|
|
|
[{
|
|
|
|
while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do {
|
|
|
|
private ["_entry"];
|
|
|
|
_entry = GVAR(waitAndExecArray) deleteAt 0;
|
|
|
|
(_entry select 2) call (_entry select 1);
|
|
|
|
};
|
|
|
|
if ((count GVAR(waitAndExecArray)) == 0) then {
|
|
|
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
|
|
|
};
|
|
|
|
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
|
|
|
};
|