top of page

MAKE RESTART MESSAGE

There are 2 ways to make restart message : the dialog message (common system) and the countdown system

​

​

​

Dialog message

​

Place inside InitServer.sqf the following script :

​

waitUntil{time > 10500};
"Server will restart in 5 minutes" remoteExec["systemChat"];
waitUntil{time > 10510};
"Server will restart in 5 minutes" remoteExec["systemChat"];
waitUntil{time > 10520};
"Server will restart in 5 minutes" remoteExec["systemChat"];

​

Your server will show after 10500 seconds message "Server will restart in 5 minutes"

​

​

ATTENTION : place theses lines after all the scripts in the initserver.sqf, to avoid possible conflicts (this lines must be the last lines in the files, do not place it like in the top of the files before others scripts for exemple)

​

​

​

Countdown system

​

In Init.sqf place :

​

​

[] execVM "message.sqf";

​

​

Make file message.sqf inside your mission folder and paste inside :

​

​

​

END_TIME = 10500; //When mission should end in seconds.

if (isServer) then {
[] spawn
{
               ELAPSED_TIME  = 0;
    START_TIME = diag_tickTime;
    while {ELAPSED_TIME < END_TIME} do
    {
        ELAPSED_TIME = diag_tickTime - START_TIME;
        publicVariable "ELAPSED_TIME";
        sleep 1;
    };
};
};


if!(isDedicated) then
{
[] spawn
{
    while{ELAPSED_TIME < END_TIME } do
    {
        _time = END_TIME - ELAPSED_TIME;
        _finish_time_minutes = floor(_time / 60);
        _finish_time_seconds = floor(_time) - (60 * _finish_time_minutes);
        if(_finish_time_seconds < 10) then
        {
            _finish_time_seconds = format ["0%1", _finish_time_seconds];
        };
        if(_finish_time_minutes < 10) then
        {
            _finish_time_minutes = format ["0%1", _finish_time_minutes];
        };
        _formatted_time = format ["%1:%2", _finish_time_minutes, _finish_time_seconds];

        hintSilent format ["Time left before restart:\n%1", _formatted_time];
        sleep 1;
    };
};
};

​

​

Your server will show to everybody the time until restart, and this timer will be focus on the server timer, not in local (exemple : you can disconnect wait and come back, the time will pass itself, not depending of your computer)

​

​

​

bottom of page