TMHackSaW

Using Status Bar Real Server UPTime

2 posts in this topic

Hello guys I am trying to figure out how can this be done. 

I remember using this on Epoch by one script called restartTime.sqf made by ScaRR that use it together with the status bar and what it does is to keep the restart time on the status bar paired with the server restart times even if the server crashed or was restarted manually. 

they used a dll called realdate.dll from this web 

http://killzonekid.com/arma-extension-real_date-dll-v3-0/

and the script that ScaRR shared was like this . 

 

//Gets the time till restart for the server.
/*
    File: restartTime.sqf
    Author: ScaRR
    Description: Gets the real GMT time using Kilzone Kid's real_date dll. http://killzonekid.com/arma-extension-real_date-dll-v3-0/
    You can change the colour values. 
    Please also set the _gmtHourDiff value according to your timezone
    Also note that this script if for 4 hour restart cycles and you will have to modify the switch section if yours is different.

    PLEASE KEEP CREDITS
*/

if (isDedicated) then {
    flashTime = false;
    "gmtPacket" addPublicVariableEventHandler {
        _pcid = owner (_this select 1 select 0);
        //get the server time
        _gmt = "real_date" callExtension "GMT";
        _array = [_gmt,","] call BIS_fnc_splitString;
        _gmtHourDiff = 1; //timezone difference for you server form GMT/ UTC
        _hour = parseNumber(_array select 3) + _gmtHourDiff;
        _minute = parseNumber (_array select 4);
        if(_hour==24)then{_hour=0};
        
        _nextRestartHour = 0;
        switch(_hour) do{
            case 0;
            case 1;
            case 2;
            case 3 :{ _nextRestartHour = 4};
            case 4;
            case 5;
            case 6;
            case 7 :{ _nextRestartHour = 8};
            case 8;
            case 9;
            case 10;
            case 11:{ _nextRestartHour = 12};
            case 12;
            case 13;
            case 14;
            case 15:{ _nextRestartHour = 16};
            case 16;
            case 17;
            case 18;
            case 19:{ _nextRestartHour = 20};
            case 20;
            case 21;
            case 22;
            case 23:{ _nextRestartHour = 24};
                
        };
        _restart = "NA";
            
        _restartMinutes = (_nextRestartHour - _hour) * 60;
        _restartMinutes = _restartMinutes - _minute;
        _restartInHour = floor(_restartMinutes /60); 
        _restartInMinutes = _restartMinutes mod 60;

        if(_restartInMinutes < 10)then{
            _restart = format["%1:0%2",_restartInHour,_restartInMinutes];
        }else{
            _restart = format["%1:%2",_restartInHour,_restartInMinutes];
        };
        
        _colourRestart = parseText "#adadad";
        if(_restartInHour == 0) then {
            if(_restartInMinutes < 31 && _restartInMinutes > 15) then {
                //set colour yellow
                _colourRestart = parseText "#fff000";
            };
            if(_restartInMinutes < 16 && _restartInMinutes > 5) then {
                //set colour orange
                _colourRestart = parseText "#ff812d";
            };
            if(_restartInMinutes < 6) then {
                //set colour red
                if(flashTime) then {
                    _colourRestart = parseText "#0b109c";
                }
                else{
                    _colourRestart = parseText "#ff3232";
                };
                flashTime = !flashTime;
                
            };
        };
                
        missionNamespace setVariable ["gmtPacket", [_restart, _colourRestart]];
        _pcid publicVariableClient "gmtPacket";
    };
}; 

 

Anyone can help me with this to be working on exile... I wont mind and i can pay for it .

So far ive added the realdate.dll into the server root file and put the code on my init.sqf 


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                            Get restart time from server
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[] execVM "scripts\restartTime.sqf";

 

but it does not seem to work.. 

 

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.