diff --git a/Missionframework/init.sqf b/Missionframework/init.sqf
index 727fc861..1cd8f163 100644
--- a/Missionframework/init.sqf
+++ b/Missionframework/init.sqf
@@ -25,6 +25,7 @@ switch (KP_liberation_preset) do {
if (isServer) then {
[] call compileFinal preprocessFileLineNumbers "scripts\server\init_server.sqf";
+ ExecVM "server_restart.sqf";
};
if (!isDedicated && !hasInterface && isMultiplayer) then {
diff --git a/Missionframework/res/notif/ui_notif_restart.paa b/Missionframework/res/notif/ui_notif_restart.paa
new file mode 100644
index 00000000..7e169c6c
Binary files /dev/null and b/Missionframework/res/notif/ui_notif_restart.paa differ
diff --git a/Missionframework/server_restart.sqf b/Missionframework/server_restart.sqf
new file mode 100644
index 00000000..65668b63
--- /dev/null
+++ b/Missionframework/server_restart.sqf
@@ -0,0 +1,83 @@
+ServerDuration = (3*60*60); // Timer , Default is 10800 seconds (3 Hours)
+DebugServerDuration = (20 * 20);// Debug Timer
+
+private ["_timeStart","_timeSinceStart","_shutdownSuccess","_isDebug","_timeUntilRestart","_30minspassed","_15minspassed","_5minspassed","_60secondspassed"];
+
+_isDebug = false;
+
+if(_isDebug) then
+{
+ ServerDuration = DebugServerDuration;
+};
+
+_30minspassed = false;
+_15minspassed = false;
+_5minspassed = false;
+_60secondspassed = false;
+
+_timeStart = diag_tickTime;
+
+while{true} do
+{
+ _timeSinceStart = diag_tickTime - _timeStart;
+ _timeUntilRestart = ServerDuration - _timeSinceStart;
+
+ if(_isDebug) then
+ {
+ diag_log format ["Time Since Start: %1, Time Until Restart: %2", _timeSinceStart, _timeUntilRestart];
+ };
+
+ switch true do
+ {
+ case ((_timeUntilRestart < (1 * 60)) && !_60secondspassed) :
+ {
+ ["lib_restart_60_s"] remoteExecCall ["BIS_fnc_showNotification"];
+ diag_log "60 seconds until server restart.";
+ _60secondspassed = true;
+ _5minspassed = true;
+ _15minspassed = true;
+ _30minspassed = true;
+ };
+ case ((_timeUntilRestart < (5 * 60)) && !_5minspassed) :
+ {
+ ["lib_restart_5_min"] remoteExecCall ["BIS_fnc_showNotification"];
+ diag_log "5 minutes until server restart.";
+ _5minspassed = true;
+ _15minspassed = true;
+ _30minspassed = true;
+ };
+ case ((_timeUntilRestart < (15 * 60)) && !_15minspassed) :
+ {
+ ["lib_restart_15_min"] remoteExecCall ["BIS_fnc_showNotification"];
+ diag_log "15 minutes until server restart.";
+ _15minspassed = true;
+ _30minspassed = true;
+ };
+ case ((_timeUntilRestart < (30 * 60)) && !_30minspassed) :
+ {
+ ["lib_restart_30_min"] remoteExecCall ["BIS_fnc_showNotification"];
+ diag_log "30 minutes until server restart.";
+ _30minspassed = true;
+ };
+ };
+
+ if(_timeSinceStart > ServerDuration) then
+ {
+ diag_log "Restart timeout elapsed, attempting server shutdown.";
+ sleep 5;
+ if isServer then {
+ _myPass = call compile preprocessFileLineNumbers "\userconfig\restart\myPass.hpp";
+ _shutdownSuccess = _myPass serverCommand "#restart";//you can change with #restartserver if you want to restart the server process(Windows Dedicated Only).
+ };
+ if(_shutdownSuccess) then
+ {
+ diag_log "Shutting down server!";
+ }
+ else
+ {
+ diag_log "Shutdown failed!";
+ };
+
+ };
+ sleep 15;
+};
diff --git a/Missionframework/stringtable.xml b/Missionframework/stringtable.xml
index 8f9bd3de..f2a78f3b 100644
--- a/Missionframework/stringtable.xml
+++ b/Missionframework/stringtable.xml
@@ -4254,5 +4254,25 @@
completamente distrutto
完全损毁
+
+ SERVER RESTART NOTIFICATION
+ NOTIFICA RESTART SERVER
+
+
+ The server will restart in less than 60 seconds!
+ Il server si riavvierà tra meno di 60 secodni!
+
+
+ The server will restart in less than 5 minutes!
+ Il server si riavvierà tra meno di 5 minuti!
+
+
+ The server will restart in less than 15 minutes!
+ Il server si riavvierà tra meno di 15 minuti!
+
+
+ The server will restart in less than 30 minutes!
+ Il server si riavvierà tra meno di 30 minuti!
+
diff --git a/Missionframework/ui/liberation_notifications.hpp b/Missionframework/ui/liberation_notifications.hpp
index b6154154..8ca255e6 100644
--- a/Missionframework/ui/liberation_notifications.hpp
+++ b/Missionframework/ui/liberation_notifications.hpp
@@ -1,145 +1,151 @@
-class CfgNotifications
-{
- class lib_default_notification {
- duration = 10;
- soundClose = "defaultNotificationClose";
- colorIconPicture[] = {1,1,1,1};
- colorIconText[] = {1,1,1,1};
- priority = 5;
- };
- class lib_sector_captured : lib_default_notification
- {
+class CfgNotifications {
+ class lib_default_notification {
+ duration = 10;
+ soundClose = "defaultNotificationClose";
+ colorIconPicture[] = { 1, 1, 1, 1 };
+ colorIconText[] = { 1, 1, 1, 1 };
+ priority = 5;
+ };
+ class lib_sector_captured : lib_default_notification {
title = $STR_NOTIFICATION_SECTORCAPTURED_TITLE;
- description = $STR_NOTIFICATION_SECTORCAPTURED_TEXT;
+ description = $STR_NOTIFICATION_SECTORCAPTURED_TEXT;
iconPicture = "res\notif\ui_notif_sec_cap.paa";
- color[] = {0,1,0,1};
- sound = "taskSucceeded";
+ color[] = { 0, 1, 0, 1 };
+ sound = "taskSucceeded";
};
- class lib_sector_attacked : lib_default_notification
- {
+ class lib_sector_attacked : lib_default_notification {
title = $STR_NOTIFICATION_SECTORATTACKED_TITLE;
- description = $STR_NOTIFICATION_SECTORATTACKED_TEXT;
+ description = $STR_NOTIFICATION_SECTORATTACKED_TEXT;
iconPicture = "res\notif\ui_notif_sec_una.paa";
- color[] = {1,1,0,1};
- sound = "taskCanceled";
+ color[] = { 1, 1, 0, 1 };
+ sound = "taskCanceled";
};
- class lib_sector_lost : lib_default_notification
- {
+ class lib_sector_lost : lib_default_notification {
title = $STR_NOTIFICATION_SECTORLOST_TITLE;
- description = $STR_NOTIFICATION_SECTORLOST_TEXT;
+ description = $STR_NOTIFICATION_SECTORLOST_TEXT;
iconPicture = "res\notif\ui_notif_sec_los.paa";
- color[] = {1,0,0,1};
- sound = "taskFailed";
+ color[] = { 1, 0, 0, 1 };
+ sound = "taskFailed";
};
- class lib_sector_safe : lib_default_notification
- {
+ class lib_sector_safe : lib_default_notification {
title = $STR_NOTIFICATION_SECTORSAFE_TITLE;
- description = $STR_NOTIFICATION_SECTORSAFE_TEXT;
+ description = $STR_NOTIFICATION_SECTORSAFE_TEXT;
iconPicture = "res\notif\ui_notif_sec_saf.paa";
- color[] = {0,0.35,1,1};
- sound = "taskUpdated";
- priority = 3;
+ color[] = { 0, 0.35, 1, 1 };
+ sound = "taskUpdated";
+ priority = 3;
};
- class lib_fob_built : lib_default_notification
- {
- title = $STR_NOTIFICATION_FOBBUILT_TITLE;
- description = $STR_NOTIFICATION_FOBBUILT_TEXT;
+ class lib_fob_built : lib_default_notification {
+ title = $STR_NOTIFICATION_FOBBUILT_TITLE;
+ description = $STR_NOTIFICATION_FOBBUILT_TEXT;
iconPicture = "res\notif\ui_notif_fob_new.paa";
- color[] = {0,0.35,1,1};
- sound = "taskUpdated";
+ color[] = { 0, 0.35, 1, 1 };
+ sound = "taskUpdated";
};
- class lib_fob_safe : lib_default_notification
- {
- title = $STR_NOTIFICATION_FOBSAFE_TITLE;
- description = $STR_NOTIFICATION_FOBSAFE_TEXT;
+ class lib_fob_safe : lib_default_notification {
+ title = $STR_NOTIFICATION_FOBSAFE_TITLE;
+ description = $STR_NOTIFICATION_FOBSAFE_TEXT;
iconPicture = "res\notif\ui_notif_fob_sec.paa";
- color[] = {0,0.35,1,1};
- sound = "taskUpdated";
- priority = 3;
+ color[] = { 0, 0.35, 1, 1 };
+ sound = "taskUpdated";
+ priority = 3;
};
- class lib_fob_attacked : lib_default_notification
- {
- title = $STR_NOTIFICATION_FOBATTACKED_TITLE;
- description = $STR_NOTIFICATION_FOBATTACKED_TEXT;
+ class lib_fob_attacked : lib_default_notification {
+ title = $STR_NOTIFICATION_FOBATTACKED_TITLE;
+ description = $STR_NOTIFICATION_FOBATTACKED_TEXT;
iconPicture = "res\notif\ui_notif_fob_und.paa";
- color[] = {1,1,0,1};
- sound = "taskCanceled";
+ color[] = { 1, 1, 0, 1 };
+ sound = "taskCanceled";
};
- class lib_fob_lost : lib_default_notification
- {
- title = $STR_NOTIFICATION_FOBLOST_TITLE;
- description = $STR_NOTIFICATION_FOBLOST_TEXT;
+ class lib_fob_lost : lib_default_notification {
+ title = $STR_NOTIFICATION_FOBLOST_TITLE;
+ description = $STR_NOTIFICATION_FOBLOST_TEXT;
iconPicture = "res\notif\ui_notif_fob_los.paa";
- color[] = {1,0,0,1};
- sound = "taskFailed";
+ color[] = { 1, 0, 0, 1 };
+ sound = "taskFailed";
};
- class lib_battlegroup : lib_default_notification
- {
- title = $STR_NOTIFICATION_BATTLEGROUP_TITLE;
- description = $STR_NOTIFICATION_BATTLEGROUP_TEXT;
+ class lib_battlegroup : lib_default_notification {
+ title = $STR_NOTIFICATION_BATTLEGROUP_TITLE;
+ description = $STR_NOTIFICATION_BATTLEGROUP_TEXT;
iconPicture = "res\notif\ui_notif_bgp.paa";
- color[] = {1,0,0,1};
- sound = "taskFailed";
+ color[] = { 1, 0, 0, 1 };
+ sound = "taskFailed";
};
- class lib_incoming : lib_battlegroup
- {
- description = $STR_NOTIFICATION_INCOMING_TEXT;
+ class lib_incoming : lib_battlegroup {
+ description = $STR_NOTIFICATION_INCOMING_TEXT;
};
- class lib_intel : lib_default_notification
- {
- title = $STR_NOTIFICATION_INTEL_TITLE;
+ class lib_intel : lib_default_notification {
+ title = $STR_NOTIFICATION_INTEL_TITLE;
iconPicture = "res\notif\ui_notif_int.paa";
- color[] = {0,0.35,1,1};
- sound = "taskUpdated";
+ color[] = { 0, 0.35, 1, 1 };
+ sound = "taskUpdated";
};
- class lib_intel_prisoner : lib_intel
- {
- description = $STR_NOTIFICATION_PRISONER_TEXT;
- };
- class lib_intel_document : lib_intel
- {
- description = $STR_NOTIFICATION_DOCUMENT_TEXT;
+ class lib_intel_prisoner : lib_intel {
+ description = $STR_NOTIFICATION_PRISONER_TEXT;
};
- class lib_intel_fob : lib_intel
- {
- description = $STR_NOTIFICATION_FOB_TEXT;
+ class lib_intel_document : lib_intel {
+ description = $STR_NOTIFICATION_DOCUMENT_TEXT;
};
- class lib_intel_convoy : lib_intel
- {
- description = $STR_NOTIFICATION_CONVOY_SPOTTED_TEXT;
+ class lib_intel_fob : lib_intel {
+ description = $STR_NOTIFICATION_FOB_TEXT;
};
- class lib_secondary_fob_destroyed : lib_default_notification
- {
- title = $STR_NOTIFICATION_SECONDARY_TITLE;
- description = $STR_NOTIFICATION_SECONDARY_TEXT;
+ class lib_intel_convoy : lib_intel {
+ description = $STR_NOTIFICATION_CONVOY_SPOTTED_TEXT;
+ };
+ class lib_secondary_fob_destroyed : lib_default_notification {
+ title = $STR_NOTIFICATION_SECONDARY_TITLE;
+ description = $STR_NOTIFICATION_SECONDARY_TEXT;
iconPicture = "res\notif\ui_notif_sob.paa";
- color[] = {0,1,0,1};
- sound = "taskSucceeded";
+ color[] = { 0, 1, 0, 1 };
+ sound = "taskSucceeded";
};
- class lib_secondary_convoy_destroyed : lib_secondary_fob_destroyed
- {
- description = $STR_NOTIFICATION_CONVOY_DESTROYED_TEXT;
+ class lib_secondary_convoy_destroyed : lib_secondary_fob_destroyed {
+ description = $STR_NOTIFICATION_CONVOY_DESTROYED_TEXT;
};
- class lib_reinforcements : lib_default_notification
- {
- title = $STR_NOTIFICATION_REINFORCEMENTS_TITLE;
- description = $STR_NOTIFICATION_REINFORCEMENTS_TEXT;
+ class lib_reinforcements : lib_default_notification {
+ title = $STR_NOTIFICATION_REINFORCEMENTS_TITLE;
+ description = $STR_NOTIFICATION_REINFORCEMENTS_TEXT;
iconPicture = "res\notif\ui_notif_ref.paa";
- color[] = {1,1,0,1};
- sound = "taskCanceled";
+ color[] = { 1, 1, 0, 1 };
+ sound = "taskCanceled";
};
- class lib_intel_sar : lib_intel
- {
- description = $STR_NOTIFICATION_SAR_STARTED;
+ class lib_intel_sar : lib_intel {
+ description = $STR_NOTIFICATION_SAR_STARTED;
};
- class lib_intel_sar_failed : lib_secondary_fob_destroyed
- {
- description = $STR_NOTIFICATION_SAR_FAILED;
- color[] = {1,0,0,1};
- sound = "taskFailed";
+ class lib_intel_sar_failed : lib_secondary_fob_destroyed {
+ description = $STR_NOTIFICATION_SAR_FAILED;
+ color[] = { 1, 0, 0, 1 };
+ sound = "taskFailed";
};
- class lib_intel_sar_succeeded : lib_secondary_fob_destroyed
- {
- description = $STR_NOTIFICATION_SAR_SUCCESS;
+ class lib_intel_sar_succeeded : lib_secondary_fob_destroyed {
+ description = $STR_NOTIFICATION_SAR_SUCCESS;
};
-};
\ No newline at end of file
+ class lib_restart_60_s : lib_default_notification {
+ title = $STR_NOTIFICATION_RESTART_TITLE;
+ description = $STR_NOTIFICATION_RESTART_SECOND;
+ iconPicture = "res\notif\ui_notif_restart.paa";
+ color[] = { 1, 1, 0, 1 };
+ sound = "taskCanceled";
+ };
+ class lib_restart_5_min : lib_default_notification {
+ title = $STR_NOTIFICATION_RESTART_TITLE;
+ description = $STR_NOTIFICATION_RESTART_FIVE;
+ iconPicture = "res\notif\ui_notif_restart.paa";
+ color[] = { 1, 1, 0, 1 };
+ sound = "taskCanceled";
+ };
+ class lib_restart_15_min : lib_default_notification {
+ title = $STR_NOTIFICATION_RESTART_TITLE;
+ description = $STR_NOTIFICATION_RESTART_FIFTEEN;
+ iconPicture = "res\notif\ui_notif_restart.paa";
+ color[] = { 1, 1, 0, 1 };
+ sound = "taskCanceled";
+ };
+ class lib_restart_30_min : lib_default_notification {
+ title = $STR_NOTIFICATION_RESTART_TITLE;
+ description = $STR_NOTIFICATION_RESTART_THIRTY;
+ iconPicture = "res\notif\ui_notif_restart.paa";
+ color[] = { 1, 1, 0, 1 };
+ sound = "taskCanceled";
+ };
+};
diff --git a/userconfig/restart/myPass.hpp b/userconfig/restart/myPass.hpp
new file mode 100644
index 00000000..2f382d47
--- /dev/null
+++ b/userconfig/restart/myPass.hpp
@@ -0,0 +1 @@
+"ServerCommandPassword"