player2_dz

Untitled

Nov 16th, 2016
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 5.08 KB | None | 0 0
  1. /*
  2. * File:     ffv.sqf
  3. * Author:   Player2 - [email protected]
  4. * Date:     2016-03-04
  5. */
  6. private ["_in", "_slot", "_driverMove", "_action", "_veh", "_showMsg", "_slotUsed","_oldSpaceInt"];
  7.  
  8. if (p2FFV_d) then { diag_log("p2FFVDebug: Adding Dismount Actions & Running Controls Loop"); }; //Debug output
  9.  
  10. //Get slot number they are in
  11. _in         = _this;
  12.  
  13. //Get attach slot number from addAction
  14. _slot       = _in select 0;
  15.  
  16. //Get driverMove value from addAction (is used to determine if player should try to get into driver seat when dismounting to vehicle)
  17. _driverMove = _in select 2;
  18.  
  19. //save old space interrupt
  20. p2FFV_oldSpaceInt = dayz_spaceInterrupt;
  21.  
  22. //Modify player contorls to enable:
  23. // dismount to ground (F3), dismount to vehicle (F4), turn left (A), turn right (D)
  24. dayz_spaceInterrupt = compile ("
  25.     _dikCode = _this select 1;
  26.  
  27.     if (_dikCode == 0x3D || _dikCode == 0x2C) then {
  28.         dayz_lastCheckBit = diag_tickTime;
  29.         [" +(str _slot)+ ", " + (str _driverMove) + "] call P2_FFV_DismountToVeh;
  30.     };
  31.  
  32.  
  33.     if (_dikCode == 0x3E || _dikCode == 0x2F) then {
  34.         dayz_lastCheckBit = diag_tickTime;
  35.         [" + (str _slot) + "] call P2_FFV_DismountToGround;
  36.     };
  37.  
  38.  
  39.     if (_dikCode in (actionKeys 'TurnLeft')) then {
  40.         dayz_lastCheckBit = diag_tickTime;
  41.         player setDir (FFV_curAimDir - 2);
  42.         FFV_curAimDir = FFV_curAimDir - 2;
  43.     };
  44.  
  45.  
  46.     if (_dikCode in (actionKeys 'TurnRight')) then {
  47.         dayz_lastCheckBit = diag_tickTime;
  48.         player setDir (FFV_curAimDir + 2);
  49.         FFV_curAimDir = FFV_curAimDir + 2;
  50.     };
  51.  
  52.  
  53.     if (_dikCode in (actionKeys 'ReloadMagazine')) then {
  54.         dayz_lastCheckBit = diag_tickTime;
  55.         reload player;
  56.     };
  57. ");
  58.  
  59. //start as false (obv)
  60. p2FFV_exitNow = false;
  61.  
  62. //create msg to show player with controls
  63. _showMsg = {
  64.      private ["_title", "_content", "_titleText"];
  65.     _title = "Controls";
  66.     _content = format [
  67.         "%2%3Aim<t color='#397fdb' size='0.9'>*</t>:%2%4%12 or %5%1%2%3
  68. Pivot: %2%3%4%7 or %8%2%3%1
  69. Switch Optic: %2%4%11%3%1
  70. Switch Weapon: %2%4%9%3%1
  71. Get In: %2%4 F3 or Z%2%3%1
  72. Eject: %2%4 F4 or V%1
  73. %2%3<t color='#397fdb' size='0.8' align='center'>*</t><t color='#FFFFFF' size='0.55' align='center'> = Free aim is only possible when zoomed/scoped in (%10) in first person mode.</t>%1%1
  74. %6by Player2%1  
  75. www.p2codes.com",  
  76.         "<br />",
  77.         "</t>",
  78.         "<t shadow='1'shadowColor='#000000' font='TahomaB' size='0.65' color='#FFFFFF' align='left'>",
  79.         "<t shadow='1'shadowColor='#000000' font='TahomaB' size='0.60' color='#FFFFFF' align='right'>",
  80.         (actionKeysNamesArray "LookAroundToggle") select (count((actionKeysNamesArray "LookAroundToggle"))) - 1,
  81.         "<t shadow='1'shadowColor='#000000' font='TahomaB' size='0.40' color='#8BFF6B' align='center'>",
  82.         (actionKeysNamesArray "TurnLeft") select 0,
  83.         (actionKeysNamesArray "TurnRight") select 0,
  84.         (actionKeysNamesArray "Handgun") select 0,
  85.         (actionKeysNamesArray "Optics") select (count((actionKeysNamesArray "Optics"))) - 1,
  86.         (actionKeysNamesArray "OpticsMode") select (count((actionKeysNamesArray "OpticsMode"))) - 1,
  87.         (actionKeysNamesArray "LookAround") select (count((actionKeysNamesArray "LookAround"))) - 1
  88.     ];
  89.     _titleText = format[("<t font='TahomaB' size='0.90' color='#FC473A' align='center' shadow='1' shadowColor='#000000'>%1</t><br /><t shadow='1'shadowColor='#000000' font='TahomaB' size='0.70' color='#FFFFFF' align='right'>%2</t>"), _title, _content];
  90.     [
  91.         _titleText,
  92.         [safezoneX,0.50],    
  93.         [safezoneY + safezoneH - 1,1],
  94.         0.5,
  95.         0
  96.     ] spawn BIS_fnc_dynamicText;
  97. };
  98.  
  99. //play crouch anim to begin with
  100. player switchMove "aidlpknlmstpsraswpstdnon_player_idlesteady01";
  101.  
  102. //while still attached to vehicle
  103. while {alive player && p2FFV_a && (!p2FFV_exitNow)} do {
  104.     //GetVars
  105.     _slotUsed = nil;
  106.     _slotUsed = FFV_cV getVariable [format["SlotInUse_%1", _slot], nil];
  107.  
  108.     //Add Instruction Message to Screen
  109.     call _showMsg;
  110.  
  111.     //Force GUNNER camera mode if enabled via config.sqf
  112.     if (cameraView != "Gunner" && p2FFV_force1pp) then
  113.     {
  114.         player switchCamera "Gunner";
  115.     };
  116.  
  117.     //Disable Prone
  118.     if ((animationState player) == "amovppnemstpsraswpstdnon" || (animationState player) == "amovppnemstpsraswrfldnon") then {
  119.         player switchMove "aidlpknlmstpsraswpstdnon_player_idlesteady01";
  120.     };
  121.  
  122.     //Wait until we get the var
  123.     waitUntil{(!isNil '_slotUsed')};
  124.  
  125.     if (_slotUsed != player && _slotUsed != objNull && str _slotUsed != "<NULL-object>") exitWith {
  126.         //Display 'slot in use' title text
  127.         titleText [("Sorry, that slot has been taken."), "PLAIN DOWN", 1];
  128.         systemChat( "Sorry, that slot has been taken.");
  129.         if (p2FFV_d) then { diag_log("p2FFVDebug: ActionExitLoop: Slot in use"); }; //Debug output
  130.         p2FFV_exitNow = true;
  131.         [_slot,_driverMove] call P2_FFV_DismountToVeh;
  132.     };
  133. };
  134.  
  135. //reset this
  136. p2FFV_exitNow = false;
  137.  
  138. //detach player (if player is dead this should detach the body nice n fast thanks to the low sleep timer above)
  139. detach player;
  140.  
  141. //enable world damage
  142. player allowDamage true;
  143.  
  144. //update attached var
  145. p2FFV_a = false;
  146.  
  147. //Re-apply old dayz_spaceInterrupt (player controls)
  148. dayz_spaceInterrupt = p2FFV_oldSpaceInt;
  149.  
  150. //byPlayer2
Advertisement
Add Comment
Please, Sign In to add comment