/*
author: ԄӏՖҚ
description: Regelt die Restarts.
returns: nothing
*/
waitUntil{!(realTimeSippe isEqualTo [])};
//Set Vars once so they don't get called every time just once.
private _configRestartHours = getArray(missionConfigFile >> "RestartTime" >> "times" >> "RestartTimeHours");
private _configWarnTimeHours = getArray(missionConfigFile >> "RestartTime" >> "times" >> "WarnTimeHours");
private _configWarnTimeMinutes = getArray(missionConfigFile >> "RestartTime" >> "times" >> "WarnTimeMinutes");
private _configText = getArray(missionConfigFile >> "RestartTime" >> "text");
_configRestartHours params [
"_configRestartHoursOne",
"_configRestartHoursTwo",
"_configRestartHoursThree",
"_configRestartHoursFour"
];
_configWarnTimeHours params [
"_warnTimeHourOne",
"_warnTimeHourTwo",
"_warnTimeHourThree",
"_warnTimeHourFour"
];
_configWarnTimeMinutes params [
"_warnTimeMinuteOne",
"_warnTimeMinuteTwo",
"_warnTimeMinuteThree",
"_warnTimeMinuteFour",
"_warnTimeMinuteFive"
];
_configText params[
"_configTextOne",
"_configTextTwo",
"_configTextThree",
"_configTextFour",
"_configTextFive"
];
life_warnOne = true;
life_warnTwo = true;
life_warnThree = true;
life_warnFour = true;
life_warnFive = true;
for "_i" from 0 to 1 step 0 do {
private _times = realTimeSippe select 1;
private _Stunde = _times select 3;
private _Minute = _times select 4;
if(_Stunde in [_warnTimeHourOne, _warnTimeHourTwo, _warnTimeHourThree, _warnTimeHourFour])then{
//Restart Warn 1
if(_Minute isEqualTo _warnTimeMinuteOne && life_warnOne)then
{
diag_log format["Warn 1: %1 Minute %2", _configTextOne, _warnTimeMinuteOne];
[1,format ["Attention : Prochain reboot dans %1 minutes !",_configTextOne]] remoteExecCall ["life_fnc_broadcast",0];
life_warnOne = false;
};
//Restart Warn 2
if(_Minute isEqualTo _warnTimeMinuteTwo && life_warnTwo)then
{
diag_log format["Warn 2: %1 Minute %2", _configTextTwo, _warnTimeMinuteTwo];
[1,format ["Attention : Prochain reboot dans %1 minutes !",_configTextTwo]] remoteExecCall ["life_fnc_broadcast",0];
life_warnTwo = false;
};
//Restart Warn 3
if(_Minute isEqualTo _warnTimeMinuteThree && life_warnThree)then
{
diag_log format["Warn 3: %1 Minute %2", _configTextThree, _warnTimeMinuteThree];
[1,format ["Attention : Prochain reboot dans %1 minutes !",_configTextThree]] remoteExecCall ["life_fnc_broadcast",0];
life_warnThree = false;
};
//Restart Warn 4
if(_Minute isEqualTo _warnTimeMinuteFour && life_warnFour)then
{
diag_log format["Warn 4: %1 Minute %2", _configTextFour, _warnTimeMinuteFour];
[1,format ["Attention : Prochain reboot dans %1 minutes !",_configTextFour]] remoteExecCall ["life_fnc_broadcast",0];
life_warnFour = false;
};
//Restart Warn 5
if(_Minute isEqualTo _warnTimeMinuteFive && life_warnFive)then
{
diag_log format["Warn 5: %1 Minute %2", _configTextFive, _warnTimeMinuteFive];
[1,format ["Attention : Prochain reboot dans %1 minutes !",_configTextFive]] remoteExecCall ["life_fnc_broadcast",0];
life_warnFive = false;
};
};
//Actual Restart
if(_Stunde in[_configRestartHoursOne,_configRestartHoursTwo,_configRestartHoursThree,_configRestartHoursFour] && _Minute isEqualTo 0)then
{
"CE8C283FB8EDDA1F89B3BD5C7EBE8" serverCommand "#restartserver";
};
sleep 5;
};