Skip to content

Commit

Permalink
fix #9 prevent multiple timout reminders
Browse files Browse the repository at this point in the history
  • Loading branch information
McDiod committed Apr 29, 2018
1 parent c743c77 commit 737d3fd
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions functions/endings/fn_presetTimeout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ _condition = compile _condition;
}, [_winName,_condition], _time] call CBA_fnc_waitAndExecute;


if (isNil QGVAR(timeoutReminders)) then {GVAR(timeoutReminders) = []};
{
if (_time > _x) then {
[{
_timeText = if (_this < 60) then {format ["%1s",_this]} else {format ["%1min",round (_this/60)]};
_messageText = format ["There are %1 left in the round",_timeText];
["grad_notification1",["TIME",_messageText]] remoteExec ["bis_fnc_showNotification",0,false];
},_x,_time - _x] call CBA_fnc_waitAndExecute;
} else {
ERROR_2("Cannot create a %1 second reminder for timeout. Only %2 seconds max time.",_x,_time);
switch (true) do {
case (_time <= _x): {ERROR_2("Cannot create a %1 second reminder for timeout. Only %2 seconds max time.",_x,_time)};
case (_x in GVAR(timeoutReminders)): {WARNING_1("Timeout reminder %1s skipped, because one already exists.",_x)};
default {
[{
_timeText = if (_this < 60) then {format ["%1s",_this]} else {format ["%1min",round (_this/60)]};
_messageText = format ["There are %1 left in the round",_timeText];
["grad_notification1",["TIME",_messageText]] remoteExec ["bis_fnc_showNotification",0,false];
},_x,_time - _x] call CBA_fnc_waitAndExecute;

GVAR(timeoutReminders) pushBack _x;
};
};
} forEach _reminders;

0 comments on commit 737d3fd

Please sign in to comment.