Advertisement
Guest User

123

a guest
Nov 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. /*
  2. File: fn_auto_restart.sqf
  3. by Kasztura for ArmaLife.pl
  4.  
  5. Pobieranie daty systemowej.
  6. "real_date" callExtension "+"; rrrr,mm,dd,hh,mm,ss
  7. local date in Arma format; example: [2017,11,20,10,40,58,1,323,0]
  8. */
  9.  
  10. _data = call compile ("real_date" callExtension "+");
  11. waituntil { !isnil "_data" };
  12.  
  13. diag_log "-------------------------------------------------------------";
  14. diag_log format ["==> Data Systemowa = %1 <==",_data];
  15. diag_log "-------------------------------------------------------------";
  16.  
  17. _godzina = _data select 3;
  18. _minuta = _data select 4;
  19. _sekunda = _data select 5;
  20.  
  21.  
  22. 0 spawn {
  23. private ["_godzina","_minuta","_sekunda"];
  24.  
  25. while {true} do
  26. {
  27. _data = call compile ("real_date" callExtension "+");
  28. if (isNil "_data") then { waituntil { !isnil "_data" } };
  29. _godzina = _data select 3;
  30. _minuta = _data select 4;
  31. _sekunda = _data select 5;
  32.  
  33. ZEGAR_SYS = [_godzina,_minuta,_sekunda];
  34. uisleep 1;
  35. };
  36. };
  37.  
  38.  
  39. 0 spawn {
  40. if (isNil "ZEGAR_SYS") then { waituntil { !isnil "ZEGAR_SYS" } };
  41. SRV_RESTART = false;
  42. publicvariable "SRV_RESTART";
  43. _passwd = "797jktOikni1Oeo6";
  44.  
  45. while {true} do
  46. {
  47. if ((((ZEGAR_SYS select 0) == 5) || ((ZEGAR_SYS select 0) == 11) || ((ZEGAR_SYS select 0) == 17) || ((ZEGAR_SYS select 0) == 23)) && ((ZEGAR_SYS select 1) == 30) && ((ZEGAR_SYS select 2) == 0)) then
  48. {
  49. while { ((ZEGAR_SYS select 1) < 55) } do
  50. {
  51. _czas = ((ZEGAR_SYS select 1) - 55) * (-1);
  52. [format ["Zaćmienie nastąpi w ciagu %1 min...", _czas]] remoteexeccall ["systemChat", -2];
  53. // diag_log format ["Zaćmienie nastąpi w ciagu %1 min...", _czas];
  54. // diag_log format ["ZEGAR_SYS_6 = %1",ZEGAR_SYS];
  55. uisleep 60;
  56. };
  57. _passwd serverCommand "#lock";
  58. uisleep 1;
  59. ["Restart", FALSE, TRUE] remoteexeccall ["BIS_fnc_endMission", -2];
  60. SRV_RESTART = true;
  61. publicvariable "SRV_RESTART";
  62. };
  63. if ((((ZEGAR_SYS select 0) == 6) || ((ZEGAR_SYS select 0) == 12) || ((ZEGAR_SYS select 0) == 18) || ((ZEGAR_SYS select 0) == 0)) && ((ZEGAR_SYS select 1) == 0) && ((ZEGAR_SYS select 2) == 0)) then
  64. {
  65. diag_log format ["RESTART !!! GODZINA %1",(ZEGAR_SYS select 0)];
  66. uisleep 0.5;
  67. _passwd serverCommand "#shutdown"; //"#restartserver"
  68. };
  69. uisleep 1;
  70. };
  71. };
  72.  
  73. /*
  74. 0 spawn {
  75. if (isNil "ZEGAR_SYS") then { waituntil { !isnil "ZEGAR_SYS" } };
  76. while {true} do
  77. {
  78. if ((ZEGAR_SYS select 2) == 0 ) then
  79. {
  80. diag_log format ["ZEGAR_SYS_Co_Minute = %1",ZEGAR_SYS];
  81. };
  82. if (((ZEGAR_SYS select 1) == 0) && ((ZEGAR_SYS select 2) == 0)) then
  83. {
  84. diag_log format ["ZEGAR_SYS_Co_Godzinę = %1",ZEGAR_SYS];
  85. };
  86. if (((ZEGAR_SYS select 0) == 0) && ((ZEGAR_SYS select 1) == 0) && ((ZEGAR_SYS select 2) == 0)) then
  87. {
  88. diag_log format ["ZEGAR_SYS_Co_24h = %1",ZEGAR_SYS];
  89. };
  90. uisleep 1;
  91. };
  92. };
  93. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement