Advertisement
Guest User

Untitled

a guest
Feb 10th, 2015
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. /*
  2. DayZ Lock Safe
  3. Usage: [_obj] spawn player_unlockVault;
  4. Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
  5. */
  6. private ["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_holder","_weapons","_magazines","_backpacks","_alreadyPacking","_lockedClass","_text","_playerNear","_characterID","_PlayerUID"];
  7.  
  8. if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_10") , "PLAIN DOWN"]; };
  9. DZE_ActionInProgress = true;
  10.  
  11. player removeAction s_player_lockvault;
  12. s_player_lockvault = 1;
  13.  
  14. _obj = _this;
  15. _objType = typeOf _obj;
  16.  
  17. _lockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "lockedClass");
  18. _text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
  19.  
  20. // Silently exit if object no longer exists
  21. if(isNull _obj) exitWith { DZE_ActionInProgress = false; };
  22. [1,1] call dayz_HungerThirst;
  23. player playActionNow "Medic";
  24. sleep 1;
  25. [player,"tentpack",0,false] call dayz_zombieSpeak;
  26. sleep 5;
  27.  
  28. _playerNear = _obj call dze_isnearest_player;
  29. if(_playerNear) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_11") , "PLAIN DOWN"]; };
  30.  
  31. _characterID = _obj getVariable["CharacterID","0"];
  32. _objectID = _obj getVariable["ObjectID","0"];
  33. _objectUID = _obj getVariable["ObjectUID","0"];
  34. _objMoney = _obj getVariable["bankMoney",0];
  35. _ownerID = _obj getVariable["ownerPUID", "0"];
  36. _playerUID = [player] call FNC_GetPlayerUID;
  37.  
  38. if((_characterID != dayz_combination) && (_ownerID != _PlayerUID)) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; cutText [format[(localize "str_epoch_player_115"),_text], "PLAIN DOWN"]; };
  39.  
  40. _alreadyPacking = _obj getVariable["packing",0];
  41. if (_alreadyPacking == 1) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; cutText [format[(localize "str_epoch_player_116"),_text], "PLAIN DOWN"]};
  42. _obj setVariable["packing",1];
  43.  
  44. // Set the bank money of the old vault to zero early, to prevent dupe glitching by a second player
  45. _obj setVariable ["bankMoney", 0, true];
  46. if (s_bank_dialog >= 0) then {
  47. player removeAction s_bank_dialog;
  48. s_bank_dialog = -1;
  49. };
  50.  
  51. _dir = direction _obj;
  52. _pos = _obj getVariable["OEMPos",(getposATL _obj)];
  53.  
  54. if(!isNull _obj) then {
  55.  
  56. PVDZE_log_lockUnlock = [player, _obj,true];
  57. publicVariableServer "PVDZE_log_lockUnlock";
  58.  
  59. //place vault
  60. _holder = createVehicle [_lockedClass,_pos,[], 0, "CAN_COLLIDE"];
  61. _holder setdir _dir;
  62. _holder setPosATL _pos;
  63. player reveal _holder;
  64.  
  65. _holder setVariable["CharacterID",_characterID,true];
  66. _holder setVariable["ObjectID",_objectID,true];
  67. _holder setVariable["ObjectUID",_objectUID,true];
  68. _holder setVariable ["OEMPos", _pos, true];
  69. _holder setVariable ["bankMoney", _objMoney, true];
  70. _holder setVariable ["ownerPUID", _ownerID , true];
  71.  
  72. _weapons = getWeaponCargo _obj;
  73. _magazines = getMagazineCargo _obj;
  74. _backpacks = getBackpackCargo _obj;
  75.  
  76. // remove vault
  77. deleteVehicle _obj;
  78.  
  79. // Fill variables with loot
  80. _holder setVariable ["WeaponCargo", _weapons, true];
  81. _holder setVariable ["MagazineCargo", _magazines, true];
  82. _holder setVariable ["BackpackCargo", _backpacks, true];
  83.  
  84. cutText [format[(localize "str_epoch_player_117"),_text], "PLAIN DOWN"];
  85. };
  86. s_player_lockvault = -1;
  87. DZE_ActionInProgress = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement