mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
see the below links for more info. uiSleep is based off of a more accurate method of tracking time, whereas sleep can fluctuate depending on application performance since it is based on framerate. https://community.bistudio.com/wiki/uiSleep https://community.bistudio.com/wiki/sleep_vs_uiSleep https://community.bistudio.com/wiki/sleep
24 lines
668 B
Plaintext
24 lines
668 B
Plaintext
private ["_object","_change","_humanity","_wait"];
|
|
//Set Variables
|
|
_object = _this select 0;
|
|
_change = _this select 1;
|
|
_humanity = 0;
|
|
|
|
if (_object == player) then {
|
|
_humanity = player getVariable["humanity",0];
|
|
_humanity = _humanity + _change;
|
|
if (_change < 0) then {
|
|
_wait = _this select 2;
|
|
player setVariable["humanity",_humanity,true];
|
|
if (player getVariable ["freeTarget",false]) then {
|
|
waitUntil{!(player getVariable ["freeTarget",false])};
|
|
};
|
|
player setVariable ["freeTarget",true,true];
|
|
//_timeStart = time;
|
|
uiSleep _wait;
|
|
player setVariable ["freeTarget",false,true];
|
|
|
|
} else {
|
|
player setVariable["humanity",_humanity,true];
|
|
};
|
|
}; |