Advertisement
Guest User

player_lockVault.sqf

a guest
Mar 5th, 2015
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 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","_vector"];
  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. _objMoney = _obj getVariable["bankMoney",0];
  31. _characterID = _obj getVariable["CharacterID","0"];
  32. _objectID = _obj getVariable["ObjectID","0"];
  33. _objectUID = _obj getVariable["ObjectUID","0"];
  34. _ownerID = _obj getVariable["ownerPUID", "0"];
  35.  
  36. if (DZE_APlotforLife) then {
  37. _playerUID = [player] call FNC_GetPlayerUID;
  38. }else{
  39. _PlayerUID = dayz_characterID;
  40. };
  41.  
  42. if((_characterID != dayz_combination) && (_ownerID != _PlayerUID)) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; cutText [format[(localize "str_epoch_player_115"),_text], "PLAIN DOWN"]; };
  43.  
  44. _alreadyPacking = _obj getVariable["packing",0];
  45. if (_alreadyPacking == 1) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; cutText [format[(localize "str_epoch_player_116"),_text], "PLAIN DOWN"]};
  46. _obj setVariable["packing",1];
  47.  
  48. _dir = direction _obj;
  49. _vector = [(vectorDir _obj),(vectorUp _obj)];
  50. _pos = _obj getVariable["OEMPos",(getposATL _obj)];
  51.  
  52. if(!isNull _obj) then {
  53.  
  54. PVDZE_log_lockUnlock = [player, _obj,true];
  55. publicVariableServer "PVDZE_log_lockUnlock";
  56.  
  57. //place vault
  58. _holder = createVehicle [_lockedClass,_pos,[], 0, "CAN_COLLIDE"];
  59. _holder setdir _dir;
  60. _holder setVariable["memDir",_dir,true];
  61. _holder setVectorDirAndUp _vector;
  62. _holder setPosATL _pos;
  63. player reveal _holder;
  64. _holder setVariable ["bankMoney", _objMoney, true];
  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 ["ownerPUID", _ownerID , true];
  70.  
  71. _weapons = getWeaponCargo _obj;
  72. _magazines = getMagazineCargo _obj;
  73. _backpacks = getBackpackCargo _obj;
  74.  
  75. // remove vault
  76. deleteVehicle _obj;
  77.  
  78. // Fill variables with loot
  79. _holder setVariable ["WeaponCargo", _weapons, true];
  80. _holder setVariable ["MagazineCargo", _magazines, true];
  81. _holder setVariable ["BackpackCargo", _backpacks, true];
  82.  
  83. cutText [format[(localize "str_epoch_player_117"),_text], "PLAIN DOWN"];
  84. };
  85. s_player_lockvault = -1;
  86. DZE_ActionInProgress = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement