Jump to content
WurschtBanane

Timer that counts down that players can see?

Recommended Posts

I want to have a countdown that counts down from 630 seconds in a normal way (not 630, 629 more like Remaining Time: 10 Minutes 30 Seconds, can be anything else that does not look awful) on the screen for EVERY PLAYER that shows up when a trigger is activated. Any script and a explanation how to use it?

Share this post


Link to post
Share on other sites
Guest

Simple way :

Display : hintSilent, systemChat

Time : _min = floor (_total/60), _sec = _total - _min * 60;

Format : parseText format ["%1 Minute(s) %2 Second(s)", _min, _sec];

Target all players : remoteExec + whitelist func in cfgRemoteExec

Count : use time fnc. (Don't use sleep shit)

Share this post


Link to post
Share on other sites

Simple way :

Display : hintSilent, systemChat

Time : _min = floor (_total/60), _sec = _total - _min * 60;

Format : parseText format ["%1 Minute(s) %2 Second(s)", _min, _sec];

Target all players : remoteExec + whitelist func in cfgRemoteExec

Count : use time fnc. (Don't use sleep shit)

Not bad but it's better to use

_time = [_sec, "MM:SS"] call BIS_fnc_secondsToString; 

for the time format, imo.

Share this post


Link to post
Share on other sites
Guest

Not bad but it's better to use

_time = [_sec, "MM:SS"] call BIS_fnc_secondsToString; 
for the time format, imo.
You are right. I knew there were one BIS function but I was lazy to check on my phone.

Share this post


Link to post
Share on other sites

Simple way :

Display : hintSilent, systemChat

Time : _min = floor (_total/60), _sec = _total - _min * 60;

Format : parseText format ["%1 Minute(s) %2 Second(s)", _min, _sec];

Target all players : remoteExec + whitelist func in cfgRemoteExec

Count : use time fnc. (Don't use sleep shit)

To be honest i do not want to do it with hints. Is there a better way, with a script or so?

Share this post


Link to post
Share on other sites
Guest

What do you want exactly ? There is an integrated timer like in challenge scenarios.

Share this post


Link to post
Share on other sites

What do you want exactly ? There is an integrated timer like in challenge scenarios.

I know, but how do i make everyone see the timer on their screen? Must work with JIP.

Share this post


Link to post
Share on other sites

I use my function for timer. It works with JIP players.

 

Usage:

[10] call MY_fnc_timer; //10 seconds timer hint

fn_timer.sqf

private _time = _this select 0;
private _text = [_this, 1, "Time Left"] call BIS_fnc_param;

[_time, _text] spawn 
{
    private _time = _this select 0;
    private _text = _this select 1;

    for [{_i=_time},{_i>=0},{_i=_i-1}] do 
    {
        format [_text + "\n%1", [((_i)/60)+.01,"HH:MM"] call BIS_fnc_timetostring] remoteExec ["hintSilent"]; 
        sleep 1;
    };
    "" remoteExec ["hintSilent"]; 
};
 

Note: I am aware of spawn/call waste here, I just have there more code inside my actual function. I deleted chuck of code that OP do not need. Dont judge me.

 

WurschtBanane Hope you will find it usefull.

  • Like 1

Share this post


Link to post
Share on other sites

 

I use my function for timer. It works with JIP players.

 

Usage:

[10, "Time left text"] call MY_fnc_timer; //10 seconds hint with text

fn_timer.sqf

private _time = _this select 0;
private _text = [_this, 1, "Time Left"] call BIS_fnc_param;

[_time, _text] spawn 
{
    private _time = _this select 0;
    private _text = _this select 1;

    while {_time > 0} do 
    {
        _time = _time - 1;
        private _input = format [_text + "\n%1", [((_time)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];
        _input remoteExec ["hintSilent"]; 
        sleep 1;
    };
    "" remoteExec ["hintSilent"]; 
};

I am aware of spawn/call waste here, I just have there more code inside. Dont judge me.

 

Hope you will find it usefull.

 

I have a similar one. Just some things I like better in mine

  • BIS_fnc_secondsToString is better than BIS_fnc_timetostring for this
  • _time > -1 is better than _time > 0 so it displays 00:00 for that dramatic explosion feeling
  • the first part is redundant, also params is a great command to use
  • Like 1

Share this post


Link to post
Share on other sites

 

I have a similar one. Just some things I like better in mine

  • BIS_fnc_secondsToString is better than BIS_fnc_timetostring for this
  • _time > -1 is better than _time > 0 so it displays 00:00 for that dramatic explosion feeling
  • the first part is redundant, also params is a great command to use

 

 

I updated little bit my code, where I use "for" instead of "while", but idea is same

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

×