Advertisement
Guest User

ExileServer_system_rcon_thread_check.sqf

a guest
Sep 3rd, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.38 KB | None | 0 0
  1. /**
  2.  * Exile Mod
  3.  * www.exilemod.com
  4.  * © 2015 Exile Mod Team
  5.  *
  6.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  7.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  8.  */
  9.  
  10. private["_restartTime","_restartMessages","_useAutoKick","_kickTime","_lockTime","_uptime","_timeTilRestart","_time","_i"];
  11. _restartTime = _this select 0;
  12. _restartMessages = _this select 1;
  13. _useAutoKick = _this select 2;
  14. _kickTime = _this select 3;
  15. _lockTime = _this select 4;
  16. _uptime = call ExileServer_util_time_uptime;
  17. _timeTilRestart = _restartTime - _uptime;
  18. if(typeName _restartMessages isEqualTo "ARRAY")then
  19. {
  20.     if!(_restartMessages isEqualTo [])then
  21.     {
  22.         {
  23.             _time = _x;
  24.             if(_timeTilRestart < _time)then
  25.             {
  26.                 if!(ExileSessions isEqualTo [])then
  27.                 {
  28.                     ["notificationRequest",["RestartWarning",[format["Server restart in %1 min!",_time]]]] call ExileServer_system_network_send_broadcast;
  29.                 };
  30.                 ExileServerRestartMessages deleteAt _forEachIndex;
  31.                 format ["Restart Warrnings for %1min sent",_time] call ExileServer_util_log;
  32.             };
  33.         }
  34.         forEach _restartMessages;
  35.     };
  36. };
  37. if(_timeTilRestart < _lockTime)then
  38. {
  39.     if!(ExileServerIsLocked)then
  40.     {
  41.         "#lock" call ExileServer_system_rcon_event_sendCommand;
  42.         "Server locked for restart" call ExileServer_util_log;
  43.         ["notificationRequest",["LockKickWarning",["You will be kicked from the server due to restart."]]] call ExileServer_system_network_send_broadcast;
  44.         ExileServerIsLocked = true;
  45.     };
  46.     if(_timeTilRestart < _kickTime)then
  47.     {
  48.         if!(ExileServerRestartMode)then
  49.         {
  50.             call ExileServer_system_rcon_event_kickAllrestart;
  51.             "Evryone kicked for restart" call ExileServer_util_log;
  52.             call ExileServer_system_rcon_event_clearBuffers;
  53.             "Buffers cleared!" call ExileServer_util_log;
  54.             for "_i" from 0 to 9 do
  55.             {
  56.                 "SERVER READY FOR RESTART!!" call ExileServer_util_log;
  57.             };
  58.             ExileServerRestartMode = true;
  59.            
  60.             //SERVERKILL//SERVERKILL//SERVERKILL//SERVERKILL//SERVERKILL
  61.             uiSleep 120; //wait until restart
  62.             while {true} do {
  63.                 "#shutdown" call ExileServer_system_rcon_event_sendCommand;  //exile SC-function
  64.                 uiSleep 3;
  65.                 "extDB2" callExtension "9:SHUTDOWN";  //extDB2 SC-function
  66.                 uiSleep 3;
  67.             };
  68.             //SERVERKILL//SERVERKILL//SERVERKILL//SERVERKILL//SERVERKILL
  69.         };
  70.     };
  71. };
  72. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement