Description
Triggers a countdown.
Note
The initial countdown can be accessed via missionNamespace's variable BIS_fnc_countdown_time.
The initial value is either
serverTime + timeInSeconds(if set globally) ortime + timeInSeconds(if set locally). To return the left-over time see #Example 4.
Syntax
[timeInSeconds, global] call BIS_fnc_countdown
Parameters:
timeInSeconds: Number or Boolean:global: Boolean - (Optional, default true) true to set it globally, false to set it locally
Returns: - Number:
- If set locally: time + timeInSeconds (see #Example 1)
- If set globally: serverTime + timeInSeconds (see #Example 2)
- Returns -1 if countdown is set to nil (see #Example 3)
- Return left-over time (see #Example 4)
- Boolean: returns true when countdown is > 0 else false (see #Example 5)
Examples
Example 1
private _initialCountdown = [50, false] call BIS_fnc_countdown; // sets countdown to 50 seconds where function is executed
Example 2
private _initialCountdown = [50] call BIS_fnc_countdown; // sets countdown to 50 seconds globally
Example 3
[-1] call BIS_fnc_countdown; // sets BIS_fnc_countdown_time to nil
Example 4
private _timeLeft = [0] call BIS_fnc_countdown; // returns the left over-time
Example 5
private _isTimeLeft = [true] call BIS_fnc_countdown; // returns true if countdown is greater than 0