Jump to content
Sign in to follow this  
1para{god-father}

Countdown timer

Recommended Posts

I have a timer that I have found made by TODO first of all is there a way to display this on all screens if in MP on a dedi server as 1 Task I would like a set time.

Also when I set the timer, and the task fails how can I stop the timer ?

Any help would be appreciated!

// ****************************************************************
// Script file for Armed Assault
// Created by: TODO: Author Name
// ****************************************************************

// Usage: nul = 20 execvm "timer.sqf"

private ["_min","_sec","_msec"];

_this = _this * 60000; // given minutes in milliseconds

while {_this > 0} do {
 _min = floor (_this / 60000); // minutes / minute in millisecs
 _sec = floor ((_this mod 60000) / 1000); // left over from full minutes / 1000 millisecs (== 1 sec)
 _msec = floor (_this mod 100);

 _min = (if (_min <= 9) then {"0"} else {""}) + str _min;
 _sec = (if (_sec <= 9) then {"0"} else {""}) + str _sec;
 _msec = (if (_msec <= 9) then {"0"} else {""}) + str _msec;

 hintsilent format["%1:%2:%3",_min,_sec,_msec];

 _this = _this - 10; // subtract 10 millisecs
 sleep 0.01; // wait 10 millisecs
};

Share this post


Link to post
Share on other sites

Boy, that TODO sure is quite the scripter. I see that guy's name everywhere :rolleyes:

But to answer your questions:

1. This script will run for everyone on a dedicated server as long as it is called by everyone. Just execute it from init or wherever else you need without using a server check, and it should run on all clients just fine.

2. Have some variable set to true at mission start. Whenever the task fails, set that variable to false. Add that variable to the condition for the while loop, i.e.:

while {_this > 0 [b]&& <yourVariableNameHere>[/b]} do { ...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×