Jump to content

[HOWTO] Adding a player statusBar


piX

Recommended Posts

//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;
    "utcPacket" addPublicVariableEventHandler {
        _pcid = owner (_this select 1 select 0);
        //get the server time
		_utc = "real_date" callExtension "UTC";
		_array = [_utc,","] call BIS_fnc_splitString;
		_utcHourDiff = 2; //timezone difference for you server form GMT/ UTC
		_hour = parseNumber(_array select 3) + _utcHourDiff;
		_minute = parseNumber (_array select 4);
		if(_hour==24)then{_hour=0};
		
		_nextRestartHour = 0;
		switch(_hour) do{
			case 0;
			case 1;
			case 2;
			case 3;
			case 4;
			case 5;{ _nextRestartHour = 6};
			case 6;
			case 7;
			case 8;
			case 9;
			case 10;
			case 11:{ _nextRestartHour = 12};
			case 12;
			case 13;
			case 14;
			case 15:
			case 16;
			case 17;{ _nextRestartHour = 18};
			case 18;
			case 19:
			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 "#adadad";
				}
				else{
					_colourRestart = parseText "#ff3232";
				};
				flashTime = !flashTime;
				
			};
		};
				
		missionNamespace setVariable ["utcPacket", [_restart, _colourRestart]];
        _pcid publicVariableClient "utcPacket";
    };
};  

Have no spoiler button found sorry

Hello,

Can someone please me adjust the Restart.sqf to 6 hours ?

0 clock , 6 clock , 12 clock 18 clock + 2 utc

Many thanks before ...

I have so tried it before :

 

Link to comment
Share on other sites

  • 4 months later...

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
  • Advertisement
×
×
  • Create New...