Guest User

Untitled

a guest
May 19th, 2013
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.61 KB | None | 0 0
  1. []execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)
  2.  
  3. dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
  4. dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
  5. _script = getText(missionConfigFile >> "onPauseScript");
  6.  
  7. if ((count playableUnits == 0) and !isDedicated) then {
  8. isSinglePlayer = true;
  9. };
  10.  
  11. waitUntil{initialized}; //means all the functions are now defined
  12.  
  13. diag_log "HIVE: Starting";
  14.  
  15. if (_script != "") then
  16. {
  17. diag_log "MISSION: File Updated";
  18. } else {
  19. while {true} do
  20. {
  21. diag_log "MISSION: File Needs Updating";
  22. sleep 1;
  23. };
  24. };
  25.  
  26. //Stream in objects
  27. /* STREAM OBJECTS */
  28. //Send the key
  29. _key = format["CHILD:302:%1:",dayZ_instance];
  30. _result = _key call server_hiveReadWrite;
  31.  
  32. diag_log "HIVE: Request sent";
  33.  
  34. //Process result
  35. _status = _result select 0;
  36.  
  37. _myArray = [];
  38. if (_status == "ObjectStreamStart") then {
  39. _val = _result select 1;
  40. //Stream Objects
  41. diag_log ("HIVE: Commence Object Streaming...");
  42. for "_i" from 1 to _val do {
  43. _result = _key call server_hiveReadWrite;
  44.  
  45. _status = _result select 0;
  46. _myArray set [count _myArray,_result];
  47. //diag_log ("HIVE: Loop ");
  48. };
  49. //diag_log ("HIVE: Streamed " + str(_val) + " objects");
  50. };
  51.  
  52. _countr = 0;
  53. {
  54.  
  55. //Parse Array
  56. _countr = _countr + 1;
  57.  
  58. _idKey = _x select 1;
  59. _type = _x select 2;
  60. _ownerID = _x select 3;
  61. _worldspace = _x select 4;
  62. _intentory= _x select 5;
  63. _hitPoints= _x select 6;
  64. _fuel = _x select 7;
  65. _damage = _x select 8;
  66.  
  67. _dir = 0;
  68. _pos = [0,0,0];
  69. _wsDone = false;
  70. if (count _worldspace >= 2) then
  71. {
  72. _dir = _worldspace select 0;
  73. if (count (_worldspace select 1) == 3) then {
  74. _pos = _worldspace select 1;
  75. _wsDone = true;
  76. }
  77. };
  78. if (!_wsDone) then {
  79. if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
  80. _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
  81. if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
  82. diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
  83. };
  84.  
  85. if (_damage < 1) then {
  86. diag_log format["OBJ: %1 - %2", _idKey,_type];
  87.  
  88. //Create it
  89. _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
  90. _object setVariable ["lastUpdate",time];
  91. if (_ownerID == "0") then {_object setVariable ["ObjectID", str(_idKey), true];} else {_object setVariable ["ObjectUID", str(_idKey),true];}; //_object setVariable ["ObjectID", _idKey, true];
  92. _object setVariable ["CharacterID", _ownerID, true];
  93.  
  94. clearWeaponCargoGlobal _object;
  95. clearMagazineCargoGlobal _object;
  96.  
  97. if (_object isKindOf "TentStorage") then {
  98. _pos set [2,0];
  99. _object setpos _pos;
  100. _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
  101. };
  102. _object setdir _dir;
  103. _object setDamage _damage;
  104.  
  105. if (count _intentory > 0) then {
  106. //Add weapons
  107. _objWpnTypes = (_intentory select 0) select 0;
  108. _objWpnQty = (_intentory select 0) select 1;
  109. _countr = 0;
  110. {
  111. if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ
  112. _isOK = isClass(configFile >> "CfgWeapons" >> _x);
  113. if (_isOK) then {
  114. _block = getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1;
  115. if (!_block) then {
  116. _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
  117. };
  118. };
  119. _countr = _countr + 1;
  120. } forEach _objWpnTypes;
  121.  
  122. //Add Magazines
  123. _objWpnTypes = (_intentory select 1) select 0;
  124. _objWpnQty = (_intentory select 1) select 1;
  125. _countr = 0;
  126. {
  127. if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
  128. _isOK = isClass(configFile >> "CfgMagazines" >> _x);
  129. if (_isOK) then {
  130. _block = getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
  131. if (!_block) then {
  132. _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
  133. };
  134. };
  135. _countr = _countr + 1;
  136. } forEach _objWpnTypes;
  137.  
  138. //Add Backpacks
  139. _objWpnTypes = (_intentory select 2) select 0;
  140. _objWpnQty = (_intentory select 2) select 1;
  141. _countr = 0;
  142. {
  143. _isOK = isClass(configFile >> "CfgVehicles" >> _x);
  144. if (_isOK) then {
  145. _block = getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1;
  146. if (!_block) then {
  147. _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
  148. };
  149. };
  150. _countr = _countr + 1;
  151. } forEach _objWpnTypes;
  152. };
  153.  
  154. if (_object isKindOf "AllVehicles") then {
  155. {
  156. _selection = _x select 0;
  157. _dam = _x select 1;
  158. if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
  159. [_object,_selection,_dam] call object_setFixServer;
  160. } forEach _hitpoints;
  161. _object setvelocity [0,0,1];
  162. _object setFuel _fuel;
  163. _object call fnc_vehicleEventHandler;
  164. };
  165.  
  166. //Monitor the object
  167. //_object enableSimulation false;
  168. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
  169. };
  170. } forEach _myArray;
  171.  
  172. // # END OF STREAMING #
  173.  
  174. //Set the Time
  175. //Send request
  176. _key = "CHILD:307:";
  177. _result = _key call server_hiveReadWrite;
  178. _outcome = _result select 0;
  179. if(_outcome == "PASS") then {
  180. _date = _result select 1;
  181. if(isDedicated) then {
  182. //["dayzSetDate",_date] call broadcastRpcCallAll;
  183. setDate _date;
  184. dayzSetDate = _date;
  185. publicVariable "dayzSetDate";
  186. };
  187.  
  188. diag_log ("HIVE: Local Time set to " + str(_date));
  189. };
  190.  
  191. createCenter civilian;
  192. if (isDedicated) then {
  193. endLoadingScreen;
  194. };
  195.  
  196. if (isDedicated) then {
  197. _id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
  198. };
  199.  
  200. allowConnection = true;
  201.  
  202. // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire, _useStatic, _preWaypoint, _crashDamage]
  203. nul = [
  204. 3, //Number of the guaranteed Loot-Piles at the Crashside
  205. 4, //Number of the random Loot-Piles at the Crashside 3+(1,2,3 or 4)
  206. 120, //Fixed-Time (in seconds) between each start of a new Chopper
  207. 60, //Random time (in seconds) added between each start of a new Chopper
  208. 1, //Spawnchance of the Heli (1 will spawn all possible Choppers, 0.5 only 50% of them)
  209. 'center', //Center-Marker for the Random-Crashpoints, for Chernarus this is a point near Stary
  210. 4000, //Radius in Meters from the Center-Marker in which the Choppers can crash and get waypoints
  211. true, //Should the spawned crashsite burn (at night) & have smoke?
  212. false, //Should the flames & smoke fade after a while?
  213. false, //Use the Static-Crashpoint-Function? If true, you have to add Coordinates into server_spawnCrashSite.sqf
  214. 1, //Amount of Random-Waypoints the Heli gets before he flys to his Point-Of-Crash (using Static-Crashpoint-Coordinates if its enabled)
  215. 1 //Amount of Damage the Heli has to get while in-air to explode before the POC. (0.0001 = Insta-Explode when any damage//bullethit, 1 = Only Explode when completly damaged)
  216. ] spawn server_spawnCrashSite;
  217.  
  218. // mmmmyum airraid
  219. nul = [] spawn server_airRaid; ///server_airRaid.sqf
Advertisement
Add Comment
Please, Sign In to add comment