Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- span class="re5"> REV_master_thread = 0;
- REV_every1Minutes = 0;
- REV_every5Minutes = 0;
- REV_every15Minutes = 0;
- REV_every30Minutes = 0;
- REV_everyHour = 0;
- REV_airCrashRandom = ((random 5400) + 1800);
- REV_oneHourMark = FALSE;
- REV_threeHourMark = FALSE;
- REV_server_5minuteTasks = {
- _text = "::REV SERVER:: Performing 5 Minute Tasks";
- diag_log _text;
- systemChat _text;
- [format ["%1", _text], 'info'] call MAR_fnc_log;
- REV_every5Minutes = time;
- if (count REV_inf_damageHistory > 0) Then {
- _tempArray = [];
- {
- _row = _x;
- {
- if (!isNil {_x select 0}) Then {
- if (_x select 0 == _row) Then {
- _qty = _x select 1;
- _tempArray pushBack [_x select 0, 1];
- };
- } else {
- if ((_x select 0) == (_row select 0)) Then {
- _qty = _x select 1;
- (_tempArray select _forEachIndex) set [(_x select 0),(_qty +1)];
- };
- };
- } forEach _tempArray;
- } forEach REV_inf_damageHistory;
- REV_inf_damageHistory = nil;
- {
- _unit = _x select 0;
- _qty = _x select 1;
- [[_qty],"REV_fnc_shotsFired",false] call BIS_fnc_MP;
- } forEach _tempArray;
- };
- if (REV_shutdownWarning == 2) Then {
- if (REV_rebootTimer < time) Then {
- REV_rebootTimer = time + 300;
- [["Auto-Reboot in 5 Minutes","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
- REV_shutdownWarning = 3;
- };
- };
- if (REV_shutdownWarning == 3) Then {
- [["Auto-Rebooting","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
- ["::REV SERVER:: Auto-Rebooting in ONE MINUTE! Saving (hopefully) players and vehicles!", 'info'] call MAR_fnc_log;
- [] spawn {
- {
- if ((count (_x getVariable ["access", []])) > 0) Then {
- ["vehicle",_x] call REV_fnc_syncObject;
- };
- } forEach vehicles;
- };
- [[false, true],"REV_fnc_syncData",playableUnits, false] call BIS_fnc_MP;
- [] spawn { sleep 60; "xyzxyz321!" serverCommand "#shutdown"; };
- REV_shutdownWarning = 4; // 1 Minute Left
- };
- {
- if ((count (units _x)) isEqualTo 0) then {
- deleteGroup _x;
- };
- } count allGroups;
- ["::REV SERVER:: Cleaned Up Groups", 'info'] call MAR_fnc_log;
- };
- REV_server_15minuteTasks = {
- _text = "::REV SERVER:: Performing 15 Minute Tasks";
- diag_log _text;
- systemChat _text;
- [format ["%1", _text], 'info'] call MAR_fnc_log;
- REV_every15Minutes = time;
- [] spawn REV_fnc_vehicleCleanup;
- if (REV_shutdownWarning == 1) Then {
- if (REV_rebootTimer < time) Then {
- REV_rebootTimer = time + 900;
- [["Auto-Reboot in 15 Minutes","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
- REV_shutdownWarning = 2;
- };
- };
- };
- REV_server_30minuteTasks = {
- _text = "::REV SERVER:: Performing 30 Minute Tasks";
- diag_log _text;
- systemChat _text;
- [format ["%1", _text], 'info'] call MAR_fnc_log;
- REV_every30Minutes = time;
- publicvariable "REV_every30Minutes"; //Needed for the importation so clients know when their goodies will arrive.
- [FALSE] spawn REV_fnc_saveCityProfits;
- [] spawn {
- {
- _properties = _x getVariable "properties";
- _id = _x getVariable "objectID";
- if !(isNil "_id") then
- {
- _query = format["UPDATE objects SET properties='%2' WHERE id='%1'",_id,_properties];
- [_query,1] call DB_fnc_asyncCall;
- };
- } forEach REV_allSetObjects;
- };
- };
- REV_server_1HourTasks = {
- _text = "::REV SERVER:: Performing Hourly Tasks";
- diag_log _text;
- systemChat _text;
- [format ["%1", _text], 'info'] call MAR_fnc_log;
- REV_everyHour = time;
- ["start"] spawn REV_fnc_airCrash;
- REV_oneHourMark = TRUE;
- };
- REV_server_task_thread = {
- REV_master_thread = REV_master_thread + 1;
- publicVariable "REV_master_thread";
- {
- _properties = _x getVariable ["properties",[]];
- if ((count _properties) > 0) Then {
- if (typeName (_properties select 0) == "STRING") Then {
- if (((_properties select 0) == "time")) Then {
- if ((_properties select 1) > 0) exitWith {
- _time = _properties select 1;
- _time = _time - 5;
- _x setVariable ["properties", ["time", _time], TRUE];
- };
- };
- } else {
- _propertiesTitle = _properties select 0 select 0;
- _properties = _properties select 0 select 1;
- if (_propertiesTitle isEqualTo "smallOreRefinery") exitWith {
- _storageQty = _properties select 0;
- _unprocessedContents = _properties select 1;
- _processedContents = _properties select 2;
- if (_oldqty < _storageQty) then {
- _storedqty = _oldqty + _incQty;
- hint str _storedqty;
- _x setVariable ["properties", [["smallOreRefinery", [_storageQty, _unprocessedContents, _processedContents]]], TRUE];
- };
- };
- if (_propertiesTitle isEqualTo "oilSmall") exitWith {
- _storageQty = _properties select 0;
- _incQty = _properties select 1;
- _oldqty = _properties select 2;
- if (_oldqty < _storageQty) then {
- _storedqty = _oldqty + _incQty;
- hint str _storedqty;
- _x setVariable ["properties", [["oilSmall", [_storageQty, _incQty, _storedqty]]], TRUE];
- };
- };
- if (_propertiesTitle isEqualTo "smallOilProcess") exitWith {
- _totalStorage = _properties select 0;
- _unprocessedStorage = _properties select 1;
- _processedStorage = _properties select 2;
- _processPerTick = _properties select 3;
- _unprocessedStorage = _unprocessedStorage - _processPerTick;
- _processedStorage = _processedStorage + _processPerTick;
- _x setVariable ["properties", [["smallOilProcess", [_totalStorage, _unprocessedStorage, _processedStorage, _processPerTick]]], TRUE];
- };
- };
- };
- } forEach REV_allSetObjects;
- if (time > (REV_every5Minutes + 300)) Then {
- [] spawn REV_server_5minuteTasks;
- };
- if (time > (REV_every15Minutes + 900)) Then {
- [] spawn REV_server_15minuteTasks;
- };
- if (time > (REV_every30Minutes + 1800)) Then {
- [] spawn REV_server_30minuteTasks;
- };
- if (time > (REV_everyHour + 3600)) Then {
- [] spawn REV_server_1HourTasks;
- };
- if (time > 10800 && !REV_threeHourMark) Then {
- REV_threeHourMark = TRUE;
- REV_shutdownWarning = 1;
- REV_rebootTimer = time + 1800;
- [["Auto-Reboot in 30 Minutes","Revolution Server",4],"TON_fnc_clientMessage",true,false] spawn BIS_fnc_MP;
- };
- };
- call REV_server_task_thread;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement