Advertisement
Guest User

Untitled

a guest
Jul 10th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. private ["_class","_uid","_charID","_object","_worldspace","_key","_fuel","_code"];
  2. //[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
  3. _charID = _this select 0;
  4. _object = _this select 1;
  5. _worldspace = _this select 2;
  6. _class = _this select 3;
  7.  
  8. if ((typeOf _object) in allbuildables_class) then {
  9. _fuel = _this select 4;
  10. _code = _this select 5; //added to pick up the code which we passed from player_build.sqf
  11.  
  12. //if (!(_object isKindOf "Building")) exitWith {
  13. //deleteVehicle _object;
  14. //};
  15. _allowed = [_object, "Server"] call check_publishobject;
  16. if (!_allowed) exitWith { };
  17.  
  18.  
  19. //diag_log ("PUBLISH: Attempt " + str(_object));
  20.  
  21. //get UID
  22. _uid = _worldspace call dayz_objectUID2;
  23.  
  24. //Send request
  25. _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], _fuel,_uid];
  26.  
  27. //diag_log ("HIVE: WRITE: "+ str(_key));
  28. _key call server_hiveWrite;
  29.  
  30. //_code = _fuel * 1000; //would be only necessary if we wouldn't pass the code from player_build.sqf
  31. _object setVariable ["Code", _code,true]; //set the Code to the Object
  32. _object setVariable ["ObjectUID", _uid,true]; //set ObjectUID to the Object
  33. _object setVariable ["Classname", _class,true]; //set Classname to the Object
  34.  
  35. if (_object isKindOf "TentStorage") then {
  36. _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
  37. };
  38.  
  39. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
  40.  
  41. //diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);
  42.  
  43. } else {
  44.  
  45. //if (!(_object isKindOf "Building")) exitWith {
  46. // deleteVehicle _object;
  47. //};
  48. _allowed = [_object, "Server"] call check_publishobject;
  49. if (!_allowed) exitWith { };
  50.  
  51.  
  52. //diag_log ("PUBLISH: Attempt " + str(_object));
  53.  
  54. //get UID
  55. _uid = _worldspace call dayz_objectUID2;
  56.  
  57. //Send request
  58. _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
  59. //_key = format["CHILD:308:%1:%2:%3:%4:%5:", dayz_instance, _class, _charID, _worldspace, _uid];
  60.  
  61. //diag_log ("HIVE: WRITE: "+ str(_key));
  62. _key call server_hiveWrite;
  63.  
  64. _object setVariable ["ObjectUID", _uid,true];
  65. _object setVariable ["characterID",dayz_characterID,true];
  66.  
  67. if (_object isKindOf "TentStorage") then {
  68. _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
  69. };
  70.  
  71. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
  72.  
  73. //diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);
  74.  
  75. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement