Skip to content

Instantly share code, notes, and snippets.

@jameslkingsley
Created July 2, 2016 15:09
Show Gist options
  • Save jameslkingsley/855bf3b2f31fe9efdd2af4b1198ede5e to your computer and use it in GitHub Desktop.
Save jameslkingsley/855bf3b2f31fe9efdd2af4b1198ede5e to your computer and use it in GitHub Desktop.
// Only execute this script on the server
if (!isServer) exitWith {};
// Time in seconds to start the countdown from
ARC_timer = 300;
[{
// Process arguments passed by CBA_fnc_addPerFrameHandler
params ["_args", "_handle"];
// Exit with this if the timer is less than or equal to zero
if (ARC_timer <= 0) exitWith {
// Broadcast a final hint to all machines
"Timer Finished" remoteExecCall ["hintSilent", 0];
// Remove this per frame handler
[_handle] call CBA_fnc_removePerFrameHandler;
};
// Create the text to display in the hint using this function: https://community.bistudio.com/wiki/BIS_fnc_secondsToString
private _displayText = [ARC_timer, "MM:SS"] call BIS_fnc_secondsToString;
// Broadcast the hint to all machines (https://community.bistudio.com/wiki/remoteExecCall)
_displayText remoteExecCall ["hintSilent", 0];
// Decrement the timer by 1
ARC_timer = ARC_timer - 1;
}, 1, []] call CBA_fnc_addPerFrameHandler;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment