Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.29 KB | None | 0 0
  1. private ["_dikCode","_handled","_primaryWeapon","_secondaryWeapon","_nearbyObjects","_nill","_shift","_ctrl","_alt","_dropPrimary","_dropSecondary","_iItem","_removed","_iPos","_radius","_item"];
  2. _dikCode =  _this select 1;
  3.  
  4. _handled = false;
  5.  
  6. if (_dikCode in[0x02,0x03,0x04,0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {
  7.     _handled = true;
  8. };
  9.  
  10. if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3)) then {
  11.     if(diag_tickTime - dayz_lastCheckBit > 10) then {
  12.         dayz_lastCheckBit = diag_tickTime;
  13.         call dayz_forceSave;
  14.     };
  15.     call dayz_EjectPlayer;
  16. };
  17.  
  18. // esc
  19. if (_dikCode == 0x01) then {
  20.     DZE_cancelBuilding = true;
  21.     call dayz_EjectPlayer;
  22. };
  23. // Disable ESC after death
  24. if (_dikCode == 0x01 && r_player_dead) then {
  25.     _handled = true;
  26. };
  27.  
  28. // surrender
  29. if (_dikCode in actionKeys "Surrender") then {
  30.    
  31.     _vehicle = vehicle player;
  32.     _inVehicle = (_vehicle != player);
  33.     _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  34.     _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder and !_inVehicle);
  35.    
  36.     if (_canDo and !DZE_Surrender and !(player isKindOf  "PZombie_VB")) then {
  37.         DZE_Surrender = true;
  38.         _dropPrimary = false;
  39.         _dropSecondary = false;
  40.  
  41.         _primaryWeapon = primaryWeapon player;
  42.         if (_primaryWeapon != "") then {_dropPrimary = true;};
  43.         _secondaryWeapon = "";
  44.         {
  45.             if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith {
  46.                     _secondaryWeapon = _x;
  47.             };
  48.         } forEach (weapons player);
  49.         if (_secondaryWeapon != "") then {_dropSecondary = true;};
  50.  
  51.         if (_dropPrimary or _dropSecondary) then {
  52.             player playActionNow "PutDown";
  53.             _iPos = getPosATL player;
  54.             _radius = 1;
  55.             _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
  56.             _item setposATL _iPos;
  57.             if (_dropPrimary) then {
  58.                 _iItem = _primaryWeapon;
  59.                 _removed = ([player,_iItem,1] call BIS_fnc_invRemove);
  60.                 if (_removed == 1) then {
  61.                     _item addWeaponCargoGlobal [_iItem,1];
  62.                 };
  63.             };
  64.             if (_dropSecondary) then {
  65.                 _iItem = _secondaryWeapon;
  66.                 _removed = ([player,_iItem,1] call BIS_fnc_invRemove);
  67.                 if (_removed == 1) then {
  68.                     _item addWeaponCargoGlobal [_iItem,1];
  69.                 };
  70.             };
  71.             player reveal _item;
  72.         };
  73.  
  74.         // set publicvariable that allows other player to access gear
  75.         player setVariable ["DZE_Surrendered", true, true];
  76.         // surrender animation
  77.         player playMove "AmovPercMstpSsurWnonDnon";
  78.     };
  79.     _handled = true;
  80. };
  81.  
  82. if (_dikCode in actionKeys "MoveForward") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
  83. if (_dikCode in actionKeys "MoveLeft") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
  84. if (_dikCode in actionKeys "MoveRight") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
  85. if (_dikCode in actionKeys "MoveBack") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
  86.  
  87. //Prevent exploit of drag body
  88. if ((_dikCode in actionKeys "Prone") and r_drag_sqf) exitWith { force_dropBody = true; };
  89. if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) exitWith { force_dropBody = true; };
  90.  
  91. _shift =    _this select 2;
  92. _ctrl =     _this select 3;
  93. _alt =      _this select 4;
  94.  
  95. //diag_log format["Keypress: %1", _this];
  96. if ((_dikCode in actionKeys "Gear") and (vehicle player != player) and !_shift and !_ctrl and !_alt && !dialog) then {
  97.             createGearDialog [player, "RscDisplayGear"];
  98.             _handled = true;
  99. };
  100.  
  101. if (_dikCode in (actionKeys "GetOver")) then {
  102.    
  103.     if (player isKindOf  "PZombie_VB") then {
  104.         _handled = true;
  105.         DZE_PZATTACK = true;
  106.     } else {
  107.         _nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8];
  108.         if (count _nearbyObjects > 0) then {
  109.             if((diag_tickTime - dayz_lastCheckBit > 4)) then {
  110.                 [objNull, player, rSwitchMove,"GetOver"] call RE;
  111.                 player playActionNow "GetOver";
  112.                 dayz_lastCheckBit = diag_tickTime;
  113.             } else {
  114.                 _handled = true;
  115.             };
  116.         };
  117.     };
  118. };
  119. //if (_dikCode == 57) then {_handled = true}; // space
  120. //if (_dikCode in actionKeys 'MoveForward' or _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
  121. if (_dikCode == 210) then {
  122.         _nill = execvm "Scripts\Player_Hud\playerHud.sqf";
  123. };
  124.  
  125. //if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
  126. if (_dikCode in actionKeys "PushToTalk" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  127.     dayz_lastCheckBit = diag_tickTime;
  128.     [player,50,true,(getPosATL player)] spawn player_alertZombies;
  129. };
  130. if (_dikCode in actionKeys "VoiceOverNet" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  131.     dayz_lastCheckBit = diag_tickTime;
  132.     [player,50,true,(getPosATL player)] spawn player_alertZombies;
  133. };
  134. if (_dikCode in actionKeys "PushToTalkDirect" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  135.     dayz_lastCheckBit = diag_tickTime;
  136.     [player,15,false,(getPosATL player)] spawn player_alertZombies;
  137. };
  138. if (_dikCode in actionKeys "Chat" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
  139.     dayz_lastCheckBit = diag_tickTime;
  140.     [player,15,false,(getPosATL player)] spawn player_alertZombies;
  141. };
  142. if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
  143.     //dayz_lastCheckBit = diag_tickTime;
  144.     _nill = execvm "Scripts\Player_Hud\playerHud.sqf";
  145. };
  146.  
  147. // numpad 8 0x48 now pgup 0xC9 1
  148. if ((_dikCode == 0xC9 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User15")) then {
  149.     DZE_Q = true;
  150. };
  151. // numpad 2 0x50 now pgdn 0xD1
  152. if ((_dikCode == 0xD1 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User16")) then {
  153.     DZE_Z = true;
  154. };
  155.  
  156.  
  157. // numpad 8 0x48 now pgup 0xC9 0.1
  158. if ((_dikCode == 0xC9 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User13")) then {
  159.     DZE_Q_alt = true;
  160. };
  161. // numpad 2 0x50 now pgdn 0xD1
  162. if ((_dikCode == 0xD1 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User14")) then {
  163.     DZE_Z_alt = true;
  164. };
  165.  
  166.  
  167. // numpad 8 0x48 now pgup 0xC9 0.01
  168. if ((_dikCode == 0xC9 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User7")) then {
  169.     DZE_Q_ctrl = true;
  170. };
  171. // numpad 2 0x50 now pgdn 0xD1
  172. if ((_dikCode == 0xD1 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User8")) then {
  173.     DZE_Z_ctrl = true;
  174. };
  175.  
  176.  
  177.  
  178.  
  179. // numpad 4 0x4B now Q 0x10
  180. if (_dikCode == 0x10 or (_dikCode in actionKeys "User17")) then {
  181.     DZE_4 = true;
  182. };     
  183. // numpad 6 0x4D now E 0x12
  184. if (_dikCode == 0x12 or (_dikCode in actionKeys "User18")) then {
  185.     DZE_6 = true;
  186. };
  187. // numpad 5 0x4C now space 0x39
  188. if (_dikCode == 0x39 or (_dikCode in actionKeys "User19")) then {
  189.     DZE_5 = true;
  190. };
  191.  
  192. // F key
  193. if ((_dikCode == 0x21 and (!_alt and !_ctrl)) or (_dikCode in actionKeys "User6")) then {
  194.     DZE_F = true;
  195. };
  196.  
  197. if (_dikCode == 0xDB) then {
  198.     if (tagName) then {tagName = false;titleText ["Group name tags OFF","PLAIN DOWN"];titleFadeOut 4;} else {tagName = true;titleText ["Group name tags ON","PLAIN DOWN"];titleFadeOut 4;};
  199.     _handled = true;
  200. };
  201.  
  202. if (_dikCode in actionKeys "TacticalView") then {_handled = true;};
  203.  
  204.  (_dikCode == 0xDB) then {
  205.     if (tagName) then {tagName = false;titleText ["Group name tags OFF","PLAIN DOWN"];titleFadeOut 4;} else {tagName = true;titleText ["Group name tags ON","PLAIN DOWN"];titleFadeOut 4;};
  206.     _handled = true;
  207. };
  208.  
  209. if (_dikCode in actionKeys "TacticalView") then {_handled = true;};
  210.  
  211. _handled
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement