-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimerupdateclient.sqf
43 lines (38 loc) · 1.06 KB
/
timerupdateclient.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
private ["_lastTime", "_actualDisplayedTime", "_seconds", "_minutes", "_displayString", "_pausedString"];
timeLeftPVHandler =
{
endTime = time + (_this select 0);
timerUpdated = true;
};
"timeLeft" addPublicVariableEventHandler
{
[_this select 1] call timeLeftPVHandler;
};
waitUntil {!isNil "timeLeft"};
waitUntil {!isNil "fakeExtraDefenderTime"};
endTime = time + timeLeft;
while {true} do
{
timerUpdated = false;
_lastTime = floor (endTime - time);
_actualDisplayedTime = _lastTime;
if (sidePlayer != attackerSide) then
{
_actualDisplayedTime = _lastTime + fakeExtraDefenderTime;
};
_seconds = floor (_actualDisplayedTime mod 60);
_minutes = floor (_actualDisplayedTime / 60);
if (_actualDisplayedTime < 0) then
{
_seconds = 0;
_minutes = 0;
};
_pausedString = "";
if (adminPaused && !roundInProgress) then
{
_pausedString = " (P)";
};
_displayString = format ["%1:%2%3%4", _minutes, floor (_seconds / 10), floor (_seconds mod 10), _pausedString];
[_displayString] call fnc_HUDUpdate;
waitUntil {timerUpdated || ((endTime - time) < _lastTime)};
};