Advertisement
Guest User

Untitled

a guest
May 21st, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. private ["_player","_vehicledata","_arrow","_key","_garage","_class","_cid","_colour1","_inventory","_fuel","_damage","_hitpoints","_location","_dir","_worldspace","_uid","_vehiclelist","_newlist"];
  2. _player = _this select 0;
  3. _vehicledata = _this select 1;
  4. _arrow = _this select 2;
  5. _garage = _this select 3;
  6. _location = _this select 4;
  7.  
  8. _class = _vehicledata select 0;
  9. _cid = str(_vehicledata select 1);
  10. _colour1 = _vehicledata select 2;
  11. _colour2 = _vehicledata select 3;
  12. _inventory = _vehicledata select 4;
  13. _fuel = _vehicledata select 5;
  14. _damage = _vehicledata select 6;
  15. _hitpoints = _vehicledata select 7;
  16.  
  17. _dir = getDir _garage;
  18. _worldspace = [_dir,_location];
  19.  
  20. _uid = _worldspace call dayz_objectUID3;
  21. _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _cid, _worldspace, [], [], 1,_uid];
  22. diag_log ("HIVE: WRITE: "+ str(_key));
  23. _key call server_hiveWrite;
  24.  
  25. [_arrow,_uid,_cid,_class,_dir,_location,_player,_colour1,_colour2,_inventory,_fuel,_damage,_hitpoints] spawn {
  26. private ["_object","_uid","_characterID","_done","_retry","_key","_result","_outcome","_oid","_class","_location","_object_para","_activatingPlayer","_colour1","_colour2","_inventory","_fuel","_damage","_hitpoints","_clrinit","_clrinit2","_objWpnTypes","_objWpnQty","_countr"];
  27. _object = _this select 0;
  28. _uid = _this select 1;
  29. _characterID = _this select 2;
  30. _class = _this select 3;
  31. _dir = _this select 4;
  32. _location = _this select 5;
  33. _activatingPlayer = _this select 6;
  34. _colour1 = _this select 7;
  35. _colour2 = _this select 8;
  36. _inventory = _this select 9;
  37. _fuel = _this select 10;
  38. _damage = _this select 11;
  39. _hitpoints = _this select 12;
  40.  
  41. _done = false;
  42. _retry = 0;
  43. while {_retry < 10} do {
  44. sleep 1;
  45. _key = format["CHILD:388:%1:",_uid];
  46. diag_log ("HIVE: WRITE: "+ str(_key));
  47. _result = _key call server_hiveReadWrite;
  48. _outcome = _result select 0;
  49. if (_outcome == "PASS") then {
  50. _oid = _result select 1;
  51. diag_log("CUSTOM: Selected " + str(_oid));
  52. _done = true;
  53. _retry = 100;
  54. } else {
  55. diag_log("CUSTOM: trying again to get id for: " + str(_uid));
  56. _done = false;
  57. _retry = _retry + 1;
  58. };
  59. };
  60. deleteVehicle _object;
  61.  
  62. if(!_done) exitWith { diag_log("CUSTOM: failed to get id for : " + str(_uid)); };
  63.  
  64. _object = createVehicle [_class, _location, [], 0, "CAN_COLLIDE"];
  65. diag_log format ["[Schwede_Debug]: _class: %3 | _object getPos: %1 | _object getPosATL: %2",(getPos _object),(getPosATL _object), _class];
  66. _object setposATL _location;
  67. diag_log format ["[Schwede_Debug]: _class: %3 | _object getPos: %1 | _object getPosATL: %2",(getPos _object),(getPosATL _object), _class];
  68. _object setDir _dir;
  69. _object setvehiclelock "locked";
  70.  
  71. clearWeaponCargoGlobal _object;
  72. clearMagazineCargoGlobal _object;
  73.  
  74. _object setVariable ["ObjectID", _oid, true];
  75. _object setVariable ["lastUpdate",time];
  76. _object setVariable ["CharacterID",_characterID, true];
  77.  
  78. if (_colour1 != "0") then {
  79. _object setVariable ["Colour",_colour1,true];
  80. _clrinit = format ["#(argb,8,8,3)color(%1)",_colour1];
  81. _object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
  82. };
  83. if (_colour2 != "0") then {
  84. _object setVariable ["Colour2",_colour2,true];
  85. _clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
  86. _object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
  87. };
  88.  
  89. _objWpnTypes = (_inventory select 0) select 0;
  90. _objWpnQty = (_inventory select 0) select 1;
  91. _countr = 0;
  92. {
  93. if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
  94. _x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
  95. };
  96. _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
  97. _countr = _countr + 1;
  98. } count _objWpnTypes;
  99.  
  100. _objWpnTypes = (_inventory select 1) select 0;
  101. _objWpnQty = (_inventory select 1) select 1;
  102. _countr = 0;
  103. {
  104. if (_x == "BoltSteel") then { _x = "WoodenArrow" };
  105. if (_x == "ItemTent") then { _x = "ItemTentOld" };
  106. _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
  107. _countr = _countr + 1;
  108. } count _objWpnTypes;
  109.  
  110. _objWpnTypes = (_inventory select 2) select 0;
  111. _objWpnQty = (_inventory select 2) select 1;
  112. _countr = 0;
  113. {
  114. _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
  115. _countr = _countr + 1;
  116. } count _objWpnTypes;
  117.  
  118. _object setFuel _fuel;
  119. _object setDamage _damage;
  120.  
  121. {
  122. private ["_selection","_dam"];
  123. _selection = _x select 0;
  124. _dam = _x select 1;
  125. if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
  126. [_object,_selection,_dam] call object_setFixServer;
  127. } forEach _hitpoints;
  128.  
  129. PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
  130. _object call fnc_veh_ResetEH;
  131. PVDZE_veh_Init = _object;
  132. publicVariable "PVDZE_veh_Init";
  133. };
  134.  
  135. _vehiclelist = _garage getVariable ["StoredVehicles",[]];
  136.  
  137. _newlist = [];
  138. {
  139. private ["_data","_toremove"];
  140. _toremove = false;
  141. if ((_x select 1) == _cid) then { _toremove = true; };
  142. if (!_toremove) then {
  143. _data = [(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6),(_x select 7)];
  144. _newlist set [count _newlist,_data];
  145. };
  146. } count _vehiclelist;
  147.  
  148. _garage setVariable ["StoredVehicles",_newlist,true];
  149.  
  150. diag_log format["VIRTUAL GARAGE: Player %1 (%2) has spawned a %3 | "+str _newlist+"",(name _player),(getPlayerUID _player),_class];
  151.  
  152. [_garage,"gear",_newlist] spawn server_updateObject;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement