Guest User

player_copyKey.sqf EPOCH 1.0.5.1

a guest
Aug 28th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. private ["_item","_config","_onLadder","_create","_started","_finished","_animState","_isMedic","_qty","_b0x1337","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"];
  2.  
  3. if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_56") , "PLAIN DOWN"]; };
  4. DZE_ActionInProgress = true;
  5.  
  6. _item = _this;
  7. _config = configFile >> "cfgWeapons" >> _item;
  8.  
  9. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  10. if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_player_21") , "PLAIN DOWN"]};
  11.  
  12. _text = getText (_config >> "displayName");
  13. _haskey = _this in weapons player;
  14. if (!_haskey) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_30"),_text] , "PLAIN DOWN"]};
  15.  
  16. _hastoolweapon = "ItemKeyKit" in weapons player;
  17. if (!_hastoolweapon) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_57") , "PLAIN DOWN"]};
  18.  
  19. _isNear = {inflamed _x} count (getPosATL player nearObjects 3);
  20. if(_isNear == 0) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_58") , "PLAIN DOWN"]};
  21.  
  22. call gear_ui_init;
  23.  
  24. // require one tin bar per key
  25. _hasTinBar = "ItemTinBar" in magazines player;
  26. if(!_hasTinBar) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_59") , "PLAIN DOWN"]};
  27. [1,1] call dayz_HungerThirst;
  28. player playActionNow "Medic";
  29.  
  30. [player,"repair",0,false] call dayz_zombieSpeak;
  31. [player,50,true,(getPosATL player)] spawn player_alertZombies;
  32.  
  33. r_interrupt = false;
  34. _animState = animationState player;
  35. r_doLoop = true;
  36. _started = false;
  37. _finished = false;
  38.  
  39. while {r_doLoop} do {
  40. _animState = animationState player;
  41. _isMedic = ["medic",_animState] call fnc_inString;
  42. if (_isMedic) then {
  43. _started = true;
  44. };
  45. if (_started && !_isMedic) then {
  46. r_doLoop = false;
  47. _finished = true;
  48. };
  49. if (r_interrupt) then {
  50. r_doLoop = false;
  51. };
  52. sleep 0.1;
  53. };
  54. r_doLoop = false;
  55.  
  56. if(_finished) then {
  57.  
  58. _num_removed = ([player,"ItemTinBar"] call BIS_fnc_invRemove);
  59.  
  60. if(_num_removed == 1) then {
  61. // output key to backpack if space
  62. _create = _item;
  63. _qty = 1;
  64. _b0x1337 = unitBackpack player;
  65. _b0x1337 addWeaponCargoGlobal [_create,_qty];
  66. cutText [(localize "str_epoch_player_60") , "PLAIN DOWN"];
  67. } else {
  68. cutText [(localize "str_epoch_player_61") , "PLAIN DOWN"];
  69. };
  70. } else {
  71. r_interrupt = false;
  72. if (vehicle player == player) then {
  73. [objNull, player, rSwitchMove,""] call RE;
  74. player playActionNow "stop";
  75. };
  76. cutText [(localize "str_epoch_player_61") , "PLAIN DOWN"];
  77. };
  78. DZE_ActionInProgress = false;
Advertisement
Add Comment
Please, Sign In to add comment