Advertisement
Guest User

server_publishObject.sqf

a guest
Jul 13th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. private ["_class","_uid","_charID","_object","_worldspace","_key"];
  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. #include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
  9. _combination = 0;
  10. if (!(_object isKindOf "Building")) exitWith {
  11. deleteVehicle _object;
  12. };
  13. _allowed = [_object, "Server"] call check_publishobject;
  14. if (!_allowed) exitWith { };
  15.  
  16. //diag_log ("PUBLISH: Attempt " + str(_object));
  17.  
  18. //get UID
  19. _uid = _worldspace call dayz_objectUID2;
  20.  
  21. //Send request
  22. if (_object isKindOf "TentStorage") then { _combination = 0;} else {_combination = floor(random 899) + 100;};
  23. _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid,_combination];
  24. //diag_log ("HIVE: WRITE: "+ str(_key));
  25. _key call server_hiveWrite;
  26.  
  27. _object setVariable ["ObjectUID", _uid,true];
  28.  
  29. if (_object isKindOf "TentStorage") then {
  30. _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
  31. };
  32.  
  33. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
  34.  
  35. #ifdef OBJECT_DEBUG
  36. diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid + " and a combination of " + str(_combination) );
  37. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement