Advertisement
Guest User

error

a guest
Apr 27th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.31 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. dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
  3. dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
  4. _script = getText(missionConfigFile >> "onPauseScript");
  5. if ((count playableUnits == 0) and !isDedicated) then {
  6. isSinglePlayer = true;
  7. };
  8. waitUntil{initialized}; //means all the functions are now defined
  9. diag_log "HIVE: Starting";
  10. if (_script != "") then
  11. {
  12. diag_log "MISSION: File Updated";
  13. } else {
  14. while {true} do
  15. {
  16. diag_log "MISSION: File Needs Updating";
  17. sleep 1;
  18. };
  19. };
  20. //Stream in objects
  21. /* STREAM OBJECTS */
  22.  
  23. //Send the key
  24. _key = format["CHILD:999:select payload, loop_interval, start_delay from message where instance_id = ?:[%1]:", dayZ_instance];
  25. _data = "HiveEXT" callExtension _key;
  26. diag_log("SERVER: Fetching messages...");
  27. //Process result
  28. _result = call compile format ["%1", _data];
  29. _status = _result select 0;
  30. msgList = [];
  31. _msgCount = 0;
  32. if (_status == "CustomStreamStart") then {
  33. _val = _result select 1;
  34. for "_i" from 1 to _val do {
  35. _data = "HiveEXT" callExtension _key;
  36. _result = call compile format ["%1",_data];
  37. _status = _result select 0;
  38. msgList set [count msgList, _result];
  39. _msgCount = _msgCount + 1;
  40. };
  41. diag_log ("SERVER: Added " + str(_msgCount) + " messages!");
  42. };
  43.  
  44. //Send the key
  45. _key = format["CHILD:999:select payload, loop_interval, start_delay from message where instance_id = ?:[%1]:", dayZ_instance];
  46. _data = "HiveEXT" callExtension _key;
  47. diag_log("SERVER: Fetching messages...");
  48. //Process result
  49. _result = call compile format ["%1", _data];
  50. _status = _result select 0;
  51. msgList = [];
  52. _msgCount = 0;
  53. if (_status == "CustomStreamStart") then {
  54. _val = _result select 1;
  55. for "_i" from 1 to _val do {
  56. _data = "HiveEXT" callExtension _key;
  57. _result = call compile format ["%1",_data];
  58. _status = _result select 0;
  59. msgList set [count msgList, _result];
  60. _msgCount = _msgCount + 1;
  61. };
  62. diag_log ("SERVER: Added " + str(_msgCount) + " messages!");
  63. };
  64.  
  65. //Send the key
  66. _key = format["CHILD:999:select payload, loop_interval, start_delay from message where instance_id = ?:[%1]:", dayZ_instance];
  67. _data = "HiveEXT" callExtension _key;
  68. diag_log("SERVER: Fetching messages...");
  69. //Process result
  70. _result = call compile format ["%1", _data];
  71. _status = _result select 0;
  72. msgList = [];
  73. _msgCount = 0;
  74. if (_status == "CustomStreamStart") then {
  75. _val = _result select 1;
  76. for "_i" from 1 to _val do {
  77. _data = "HiveEXT" callExtension _key;
  78. _result = call compile format ["%1",_data];
  79. _status = _result select 0;
  80. msgList set [count msgList, _result];
  81. _msgCount = _msgCount + 1;
  82. };
  83. diag_log ("SERVER: Added " + str(_msgCount) + " messages!");
  84. };
  85. //Send the key
  86. _key = format["CHILD:302:%1:",dayZ_instance];
  87. _result = _key call server_hiveReadWrite;
  88. diag_log "HIVE: Request sent";
  89.  
  90. //Process result
  91. _status = _result select 0;
  92.  
  93. _myArray = [];
  94. if (_status == "ObjectStreamStart") then {
  95. _val = _result select 1;
  96. //Stream Objects
  97. diag_log ("HIVE: Commence Object Streaming...");
  98. for "_i" from 1 to _val do {
  99. _result = _key call server_hiveReadWrite;
  100. _status = _result select 0;
  101. _myArray set [count _myArray,_result];
  102. //diag_log ("HIVE: Loop ");
  103. };
  104. //diag_log ("HIVE: Streamed " + str(_val) + " objects");
  105. };
  106.  
  107. _countr = 0;
  108. {
  109.  
  110. //Parse Array
  111. _countr = _countr + 1;
  112.  
  113. _idKey = _x select 1;
  114. _type = _x select 2;
  115. _ownerID = _x select 3;
  116. _worldspace = _x select 4;
  117. _intentory= _x select 5;
  118. _hitPoints= _x select 6;
  119. _fuel = _x select 7;
  120. _damage = _x select 8;
  121. _dir = 0;
  122. _pos = [0,0,0];
  123. _wsDone = false;
  124. if (count _worldspace >= 2) then
  125. {
  126. _dir = _worldspace select 0;
  127. if (count (_worldspace select 1) == 3) then {
  128. _pos = _worldspace select 1;
  129. _wsDone = true;
  130. }
  131. };
  132. if (!_wsDone) then {
  133. if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
  134. _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
  135. if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
  136. diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
  137. };
  138.  
  139. if (_damage < 1) then {
  140. diag_log format["OBJ: %1 - %2", _idKey,_type];
  141.  
  142. //Create it
  143. _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
  144. _object setVariable ["lastUpdate",time];
  145. if (_ownerID == "0") then {_object setVariable ["ObjectID", str(_idKey), true];} else {_object setVariable ["ObjectUID", str(_idKey),true];}; //_object setVariable ["ObjectID", _idKey, true];
  146. _object setVariable ["CharacterID", _ownerID, true];
  147.  
  148. clearWeaponCargoGlobal _object;
  149. clearMagazineCargoGlobal _object;
  150.  
  151. if (_object isKindOf "TentStorage") then {
  152. _pos set [2,0];
  153. _object setpos _pos;
  154. _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
  155. };
  156. _object setdir _dir;
  157. _object setDamage _damage;
  158.  
  159. if (count _intentory > 0) then {
  160. //Add weapons
  161. _objWpnTypes = (_intentory select 0) select 0;
  162. _objWpnQty = (_intentory select 0) select 1;
  163. _countr = 0;
  164. {
  165. if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ
  166. _isOK = isClass(configFile >> "CfgWeapons" >> _x);
  167. if (_isOK) then {
  168. _block = getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1;
  169. if (!_block) then {
  170. _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
  171. };
  172. };
  173. _countr = _countr + 1;
  174. } forEach _objWpnTypes;
  175.  
  176. //Add Magazines
  177. _objWpnTypes = (_intentory select 1) select 0;
  178. _objWpnQty = (_intentory select 1) select 1;
  179. _countr = 0;
  180. {
  181. if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
  182. _isOK = isClass(configFile >> "CfgMagazines" >> _x);
  183. if (_isOK) then {
  184. _block = getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
  185. if (!_block) then {
  186. _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
  187. };
  188. };
  189. _countr = _countr + 1;
  190. } forEach _objWpnTypes;
  191. //Add Backpacks
  192. _objWpnTypes = (_intentory select 2) select 0;
  193. _objWpnQty = (_intentory select 2) select 1;
  194. _countr = 0;
  195. {
  196. _isOK = isClass(configFile >> "CfgVehicles" >> _x);
  197. if (_isOK) then {
  198. _block = getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1;
  199. if (!_block) then {
  200. _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
  201. };
  202. };
  203. _countr = _countr + 1;
  204. } forEach _objWpnTypes;
  205. };
  206.  
  207. if (_object isKindOf "AllVehicles") then {
  208. {
  209. _selection = _x select 0;
  210. _dam = _x select 1;
  211. if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
  212. [_object,_selection,_dam] call object_setFixServer;
  213. } forEach _hitpoints;
  214. _object setvelocity [0,0,1];
  215. _object setFuel _fuel;
  216. _object call fnc_vehicleEventHandler;
  217. };
  218. //Monitor the object
  219. //_object enableSimulation false;
  220. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
  221. };
  222. } forEach _myArray;
  223.  
  224. // # END OF STREAMING #
  225. //Send the key
  226. _key = format["CHILD:999:select b.class_name, ib.worldspace from instance_building ib join building b on ib.building_id = b.id where ib.instance_id = ?:[%1]:", dayZ_instance];
  227. _data = "HiveEXT" callExtension _key;
  228. diag_log("SERVER: Fetching buildings...");
  229. //Process result
  230. _result = call compile format ["%1", _data];
  231. _status = _result select 0;
  232. _bldList = [];
  233. _bldCount = 0;
  234. if (_status == "CustomStreamStart") then {
  235. _val = _result select 1;
  236. for "_i" from 1 to _val do {
  237. _data = "HiveEXT" callExtension _key;
  238. _result = call compile format ["%1",_data];
  239. _pos = call compile (_result select 1);
  240. _dir = _pos select 0;
  241. _pos = _pos select 1;
  242. _building = createVehicle [_result select 0, _pos, [], 0, "CAN_COLLIDE"];
  243. _building setDir _dir;
  244. _bldCount = _bldCount + 1;
  245. };
  246. diag_log ("SERVER: Spawned " + str(_bldCount) + " buildings!");
  247. };
  248. //Set the Time
  249. //Send request
  250. _key = "CHILD:307:";
  251. _result = _key call server_hiveReadWrite;
  252. _outcome = _result select 0;
  253. if(_outcome == "PASS") then {
  254. _date = _result select 1;
  255. if(isDedicated) then {
  256. //["dayzSetDate",_date] call broadcastRpcCallAll;
  257. setDate _date;
  258. dayzSetDate = _date;
  259. publicVariable "dayzSetDate";
  260. };
  261. diag_log ("HIVE: Local Time set to " + str(_date));
  262. };
  263.  
  264. createCenter civilian;
  265. if (isDedicated) then {
  266. endLoadingScreen;
  267. };
  268.  
  269. if (isDedicated) then {
  270. _id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
  271. };
  272. allowConnection = true;
  273. // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
  274. nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', 4000, true, false] spawn server_spawnCrashSite;
  275. for "_x" from 1 to 20 do {
  276. _id = [] spawn spawn_wrecks;
  277. }; //Spawn wrecks
  278. for "_x" from 1 to 6 do {
  279. _id = [] spawn spawn_carePackages;
  280. }; //Spawn care packages
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement