Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 7.67 KB | None | 0 0
  1. span class="re5"> REV_master_thread = 0;
  2.     REV_every1Minutes = 0;
  3.     REV_every5Minutes = 0;
  4.     REV_every15Minutes = 0;
  5.     REV_every30Minutes = 0;
  6.     REV_everyHour = 0;
  7.     REV_airCrashRandom = ((random 5400) + 1800);
  8.     REV_oneHourMark = FALSE;
  9.     REV_threeHourMark = FALSE;
  10.  
  11.     REV_server_5minuteTasks = {
  12.         _text = "::REV SERVER:: Performing 5 Minute Tasks";
  13.         diag_log _text;
  14.         systemChat _text;
  15.         [format ["%1", _text], 'info'] call MAR_fnc_log;
  16.  
  17.  
  18.         REV_every5Minutes = time;
  19.  
  20.         if (count REV_inf_damageHistory > 0) Then {
  21.             _tempArray = [];
  22.  
  23.             {
  24.                 _row = _x;
  25.                 {
  26.                     if (!isNil {_x select 0}) Then {
  27.                         if (_x select 0 == _row) Then {
  28.                             _qty = _x select 1;
  29.                             _tempArray pushBack [_x select 0, 1];
  30.                         };
  31.                     } else {
  32.  
  33.                         if ((_x select 0) == (_row select 0)) Then {
  34.                             _qty = _x select 1;
  35.                             (_tempArray select _forEachIndex) set [(_x select 0),(_qty +1)];
  36.                         };
  37.  
  38.                     };
  39.                 } forEach _tempArray;
  40.             } forEach REV_inf_damageHistory;
  41.  
  42.             REV_inf_damageHistory = nil;
  43.  
  44.             {
  45.                 _unit = _x select 0;
  46.                 _qty = _x select 1;
  47.                 [[_qty],"REV_fnc_shotsFired",false] call BIS_fnc_MP;
  48.             } forEach _tempArray;
  49.         };
  50.  
  51.         if (REV_shutdownWarning == 2) Then {
  52.             if (REV_rebootTimer < time) Then {
  53.                 REV_rebootTimer = time + 300;
  54.                 [["Auto-Reboot in 5 Minutes","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
  55.                 REV_shutdownWarning = 3;
  56.             };
  57.         };
  58.  
  59.         if (REV_shutdownWarning == 3) Then {
  60.             [["Auto-Rebooting","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
  61.             ["::REV SERVER:: Auto-Rebooting in ONE MINUTE! Saving (hopefully) players and vehicles!", 'info'] call MAR_fnc_log;
  62.             [] spawn {
  63.  
  64.                 {
  65.                     if ((count (_x getVariable ["access", []])) > 0) Then {
  66.                         ["vehicle",_x] call REV_fnc_syncObject;
  67.                     };
  68.                 } forEach vehicles;
  69.  
  70.             };
  71.             [[false, true],"REV_fnc_syncData",playableUnits, false] call BIS_fnc_MP;
  72.             [] spawn { sleep 60; "xyzxyz321!" serverCommand "#shutdown"; };
  73.             REV_shutdownWarning = 4; // 1 Minute Left
  74.  
  75.         };
  76.  
  77.         {
  78.             if ((count (units _x)) isEqualTo 0) then {
  79.                 deleteGroup _x;
  80.             };
  81.         } count allGroups;
  82.  
  83.         ["::REV SERVER:: Cleaned Up Groups", 'info'] call MAR_fnc_log;
  84.     };
  85.  
  86.     REV_server_15minuteTasks = {
  87.         _text = "::REV SERVER:: Performing 15 Minute Tasks";
  88.         diag_log _text;
  89.         systemChat _text;
  90.         [format ["%1", _text], 'info'] call MAR_fnc_log;
  91.         REV_every15Minutes = time;
  92.  
  93.         [] spawn REV_fnc_vehicleCleanup;
  94.         if (REV_shutdownWarning == 1) Then {
  95.             if (REV_rebootTimer < time) Then {
  96.                 REV_rebootTimer = time + 900;
  97.                 [["Auto-Reboot in 15 Minutes","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
  98.                 REV_shutdownWarning = 2;
  99.             };
  100.  
  101.         };
  102.     };
  103.  
  104.     REV_server_30minuteTasks = {
  105.         _text = "::REV SERVER:: Performing 30 Minute Tasks";
  106.         diag_log _text;
  107.         systemChat _text;
  108.         [format ["%1", _text], 'info'] call MAR_fnc_log;
  109.  
  110.         REV_every30Minutes = time;
  111.         publicvariable "REV_every30Minutes"; //Needed for the importation so clients know when their goodies will arrive.
  112.  
  113.         [FALSE] spawn REV_fnc_saveCityProfits;
  114.  
  115.         [] spawn {
  116.             {
  117.                 _properties = _x getVariable "properties";
  118.                 _id = _x getVariable "objectID";
  119.  
  120.                 if !(isNil "_id") then
  121.                 {
  122.                     _query = format["UPDATE objects SET properties='%2' WHERE id='%1'",_id,_properties];
  123.                     [_query,1] call DB_fnc_asyncCall;
  124.                 };
  125.             } forEach REV_allSetObjects;
  126.         };
  127.     };
  128.  
  129.     REV_server_1HourTasks = {
  130.         _text = "::REV SERVER:: Performing Hourly Tasks";
  131.         diag_log _text;
  132.         systemChat _text;
  133.         [format ["%1", _text], 'info'] call MAR_fnc_log;
  134.  
  135.         REV_everyHour = time;
  136.  
  137.         ["start"] spawn REV_fnc_airCrash;
  138.           REV_oneHourMark = TRUE;
  139.     };
  140.  
  141.     REV_server_task_thread = {
  142.  
  143.  
  144.         REV_master_thread = REV_master_thread + 1;
  145.         publicVariable "REV_master_thread";
  146.  
  147.         {
  148.             _properties = _x getVariable ["properties",[]];
  149.             if ((count _properties) > 0) Then {
  150.  
  151.                 if (typeName (_properties select 0) == "STRING") Then {
  152.  
  153.                     if (((_properties select 0) == "time")) Then {
  154.                         if ((_properties select 1) > 0) exitWith {
  155.                             _time = _properties select 1;
  156.                             _time = _time - 5;
  157.                             _x setVariable ["properties", ["time", _time], TRUE];
  158.                         };
  159.                     };
  160.                 } else {
  161.  
  162.                     _propertiesTitle = _properties select 0 select 0;
  163.                     _properties = _properties select 0 select 1;
  164.                     if (_propertiesTitle isEqualTo "smallOreRefinery") exitWith {
  165.                         _storageQty = _properties select 0;
  166.                         _unprocessedContents = _properties select 1;
  167.                         _processedContents = _properties select 2;
  168.                         if (_oldqty < _storageQty) then {
  169.                             _storedqty = _oldqty + _incQty;
  170.                             hint str _storedqty;
  171.                             _x setVariable ["properties", [["smallOreRefinery", [_storageQty, _unprocessedContents, _processedContents]]], TRUE];
  172.  
  173.                         };
  174.                     };
  175.  
  176.                     if (_propertiesTitle isEqualTo "oilSmall") exitWith {
  177.                         _storageQty = _properties select 0;
  178.                         _incQty = _properties select 1;
  179.                         _oldqty = _properties select 2;
  180.                         if (_oldqty < _storageQty) then {
  181.                             _storedqty = _oldqty + _incQty;
  182.                             hint str _storedqty;
  183.                             _x setVariable ["properties", [["oilSmall", [_storageQty, _incQty, _storedqty]]], TRUE];
  184.  
  185.                         };
  186.                     };
  187.  
  188.                     if (_propertiesTitle isEqualTo "smallOilProcess") exitWith {
  189.                         _totalStorage = _properties select 0;
  190.                         _unprocessedStorage = _properties select 1;
  191.                         _processedStorage = _properties select 2;
  192.                         _processPerTick = _properties select 3;
  193.  
  194.                         _unprocessedStorage = _unprocessedStorage - _processPerTick;
  195.                         _processedStorage = _processedStorage + _processPerTick;
  196.  
  197.                         _x setVariable ["properties", [["smallOilProcess", [_totalStorage, _unprocessedStorage, _processedStorage, _processPerTick]]], TRUE];
  198.  
  199.                     };
  200.                 };
  201.             };
  202.         } forEach REV_allSetObjects;
  203.  
  204.         if (time > (REV_every5Minutes + 300)) Then {
  205.             [] spawn REV_server_5minuteTasks;
  206.         };
  207.  
  208.  
  209.         if (time > (REV_every15Minutes + 900)) Then {
  210.  
  211.             [] spawn REV_server_15minuteTasks;
  212.         };
  213.  
  214.         if (time > (REV_every30Minutes + 1800)) Then {
  215.  
  216.             [] spawn REV_server_30minuteTasks;
  217.         };
  218.  
  219.         if (time > (REV_everyHour + 3600)) Then {
  220.  
  221.             [] spawn REV_server_1HourTasks;
  222.         };
  223.  
  224.         if (time > 10800 && !REV_threeHourMark) Then {
  225.             REV_threeHourMark = TRUE;
  226.             REV_shutdownWarning = 1;
  227.             REV_rebootTimer = time + 1800;
  228.             [["Auto-Reboot in 30 Minutes","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
  229.         };
  230.  
  231.     };
  232.  
  233.     call REV_server_task_thread;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement