• 0
Sign in to follow this  
Followers 0
HellBz

Realtime Restarts in ExAd Statusbar

Question

Hello @all,
Can anyone Help me with my Code ?

Every try it shows ANY in Statusbar..

This is the Original:
 

Spoiler

/*  
	fn_getTimerStr.sqf
	
	Copyright 2016 Jan Babor

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.

*/
private["_request","_time","_hours","_minutes","_img","_text"];

_request = [];

_time = serverTime;
_hours = (ExAd_SB_Timer - 1) - floor (_time / 3600);
_minutes = 59 - floor ((_time % 3600) / 60);

_img = [ExAd_SB_ICON_TIMER] call ExAd_fnc_formatSBImage;
_text = format["%1:%2", _hours,(if(_minutes < 10 )then{format["0%1",_minutes]}else{_minutes})];
_request pushBack [_img,_text];

if(ExAd_SB_COMPONENTS_ACTIVE_COLORS)then{
	if(_hours > 0)then{
		_request pushBack ([0,1,_hours] call ExAd_fnc_getSBColor)
	}else{
		_request pushBack ([0,60,_minutes] call ExAd_fnc_getSBColor)
	};
};

_request call ExAd_fnc_formatSBOutput

 


This is my Modified:
 

Spoiler

/*  
	fn_getTimerStr.sqf
	
	Copyright 2016 Jan Babor

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.

*/
private["_request","_time","_hours","_minutes","_img","_text"];

_request = [];

_realRestarts = ["04:00:00","08:00:00","12:00:00","16:00:00","20:00:00","24:00:00"];

_gottime = true;
{
	_hardServerTime = _x splitString ":";
	_hardServerTimeHour = parseNumber (_hardServerTime select 0);
	_hardServerTimeMin  = parseNumber (_hardServerTime select 1);
	_hardServerTimeSec  = parseNumber (_hardServerTime select 2);

	_hardSecondsTime = (_hardServerTimeHour * 3600);
	_hardSecondsTime = (_hardSecondsTime + (_hardServerTimeMin * 60));
	_hardSecondsTime = (_hardSecondsTime + _hardServerTimeSec);

	_currentTimestamp = call ExileServer_util_time_currentTime;
	_nowServerTimeHour = _currentTimestamp select 3; 
	_nowServerTimeMin  = _currentTimestamp select 4; 
	_nowServerTimeSec  = _currentTimestamp select 5;
	
	_nowSecondsTime = (_nowServerTimeHour * 3600);
	_nowSecondsTime = (_nowSecondsTime + (_nowServerTimeMin * 60));
	_nowSecondsTime = (_nowSecondsTime + _nowServerTimeSec);

	if( _nowSecondsTime < _hardSecondsTime ) then {
		if (_gottime) then{
			_difftime = _hardSecondsTime - _nowSecondsTime;
			_gottime = false;
		};
	};
} forEach _realRestarts;	
	
_hours = floor(_difftime / 3600);
_minutes = floor( (_difftime / 3600 ) / 60);

_img = [ExAd_SB_ICON_TIMER] call ExAd_fnc_formatSBImage;
_text = format["%1:%2", _hours,(if(_minutes < 10 )then{format["0%1",_minutes]}else{_minutes})];
_request pushBack [_img,_text];

if(ExAd_SB_COMPONENTS_ACTIVE_COLORS)then{
	if(_hours > 0)then{
		_request pushBack ([0,1,_hours] call ExAd_fnc_getSBColor)
	}else{
		_request pushBack ([0,60,_minutes] call ExAd_fnc_getSBColor)
	};
};

_request call ExAd_fnc_formatSBOutput

 

 

Edited by HellBz

Share this post


Link to post
Share on other sites

2 answers to this question

  • 0

Seems like you're over thinking it to me. Your real time restarts are every 4 hours, why not just set the original to 4 hours? 

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.