Advertisement
Guest User

Space Interpreter

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