Advertisement
Guest User

Untitled

a guest
May 21st, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.40 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.  
  7. _class = _vehicledata select 0;
  8. _cid = str(_vehicledata select 1);
  9. _colour1 = _vehicledata select 2;
  10. _colour2 = _vehicledata select 3;
  11. _inventory = _vehicledata select 4;
  12. _fuel = _vehicledata select 5;
  13. _damage = _vehicledata select 6;
  14. _hitpoints = _vehicledata select 7;
  15.  
  16. _location = getPos _arrow;
  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.  
  66. diag_log format ["[Schwede_Debug]: _location: %1 | _object getPos: %2 | _object getPosATL: %3",_location,((getPos _object)),(getPosATL _object)];
  67.  
  68. _object setposATL _location;
  69.  
  70. diag_log format ["[Schwede_Debug]: After setPos | _object getPos: %1 | _object getPosATL: %2",((getPos _object)),(getPosATL _object)];
  71.  
  72. _object setDir _dir;
  73. _object setvehiclelock "locked";
  74.  
  75. clearWeaponCargoGlobal _object;
  76. clearMagazineCargoGlobal _object;
  77.  
  78. _object setVariable ["ObjectID", _oid, true];
  79. _object setVariable ["lastUpdate",time];
  80. _object setVariable ["CharacterID",_characterID, true];
  81.  
  82. if (_colour1 != "0") then {
  83. _object setVariable ["Colour",_colour1,true];
  84. _clrinit = format ["#(argb,8,8,3)color(%1)",_colour1];
  85. _object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
  86. };
  87. if (_colour2 != "0") then {
  88. _object setVariable ["Colour2",_colour2,true];
  89. _clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
  90. _object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
  91. };
  92.  
  93. _objWpnTypes = (_inventory select 0) select 0;
  94. _objWpnQty = (_inventory select 0) select 1;
  95. _countr = 0;
  96. {
  97. if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
  98. _x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
  99. };
  100. _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
  101. _countr = _countr + 1;
  102. } count _objWpnTypes;
  103.  
  104. _objWpnTypes = (_inventory select 1) select 0;
  105. _objWpnQty = (_inventory select 1) select 1;
  106. _countr = 0;
  107. {
  108. if (_x == "BoltSteel") then { _x = "WoodenArrow" };
  109. if (_x == "ItemTent") then { _x = "ItemTentOld" };
  110. _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
  111. _countr = _countr + 1;
  112. } count _objWpnTypes;
  113.  
  114. _objWpnTypes = (_inventory select 2) select 0;
  115. _objWpnQty = (_inventory select 2) select 1;
  116. _countr = 0;
  117. {
  118. _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
  119. _countr = _countr + 1;
  120. } count _objWpnTypes;
  121.  
  122. _object setFuel _fuel;
  123. _object setDamage _damage;
  124.  
  125. {
  126. private ["_selection","_dam"];
  127. _selection = _x select 0;
  128. _dam = _x select 1;
  129. if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
  130. [_object,_selection,_dam] call object_setFixServer;
  131. } forEach _hitpoints;
  132.  
  133. PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
  134. _object call fnc_veh_ResetEH;
  135. PVDZE_veh_Init = _object;
  136. publicVariable "PVDZE_veh_Init";
  137. };
  138.  
  139. _vehiclelist = _garage getVariable ["StoredVehicles",[]];
  140.  
  141. _newlist = [];
  142. {
  143. private ["_data","_toremove"];
  144. _toremove = false;
  145. if ((_x select 1) == _cid) then { _toremove = true; };
  146. if (!_toremove) then {
  147. _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)];
  148. _newlist set [count _newlist,_data];
  149. };
  150. } count _vehiclelist;
  151.  
  152. _garage setVariable ["StoredVehicles",_newlist,true];
  153.  
  154. diag_log format["VIRTUAL GARAGE: Player %1 (%2) has spawned a %3 | "+str _newlist+"",(name _player),(getPlayerUID _player),_class];
  155.  
  156. [_garage,"gear",_newlist] spawn server_updateObject;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement