Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: ffv.sqf
- * Author: Player2 - [email protected]
- * Date: 2016-03-04
- */
- private ["_in", "_slot", "_driverMove", "_action", "_veh", "_showMsg", "_slotUsed","_oldSpaceInt"];
- if (p2FFV_d) then { diag_log("p2FFVDebug: Adding Dismount Actions & Running Controls Loop"); }; //Debug output
- //Get slot number they are in
- _in = _this;
- //Get attach slot number from addAction
- _slot = _in select 0;
- //Get driverMove value from addAction (is used to determine if player should try to get into driver seat when dismounting to vehicle)
- _driverMove = _in select 2;
- //save old space interrupt
- p2FFV_oldSpaceInt = dayz_spaceInterrupt;
- //Modify player contorls to enable:
- // dismount to ground (F3), dismount to vehicle (F4), turn left (A), turn right (D)
- dayz_spaceInterrupt = compile ("
- _dikCode = _this select 1;
- if (_dikCode == 0x3D || _dikCode == 0x2C) then {
- dayz_lastCheckBit = diag_tickTime;
- [" +(str _slot)+ ", " + (str _driverMove) + "] call P2_FFV_DismountToVeh;
- };
- if (_dikCode == 0x3E || _dikCode == 0x2F) then {
- dayz_lastCheckBit = diag_tickTime;
- [" + (str _slot) + "] call P2_FFV_DismountToGround;
- };
- if (_dikCode in (actionKeys 'TurnLeft')) then {
- dayz_lastCheckBit = diag_tickTime;
- player setDir (FFV_curAimDir - 2);
- FFV_curAimDir = FFV_curAimDir - 2;
- };
- if (_dikCode in (actionKeys 'TurnRight')) then {
- dayz_lastCheckBit = diag_tickTime;
- player setDir (FFV_curAimDir + 2);
- FFV_curAimDir = FFV_curAimDir + 2;
- };
- if (_dikCode in (actionKeys 'ReloadMagazine')) then {
- dayz_lastCheckBit = diag_tickTime;
- reload player;
- };
- ");
- //start as false (obv)
- p2FFV_exitNow = false;
- //create msg to show player with controls
- _showMsg = {
- private ["_title", "_content", "_titleText"];
- _title = "Controls";
- _content = format [
- "%2%3Aim<t color='#397fdb' size='0.9'>*</t>:%2%4%12 or %5%1%2%3
- Pivot: %2%3%4%7 or %8%2%3%1
- Switch Optic: %2%4%11%3%1
- Switch Weapon: %2%4%9%3%1
- Get In: %2%4 F3 or Z%2%3%1
- Eject: %2%4 F4 or V%1
- %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
- %6by Player2%1
- www.p2codes.com",
- "<br />",
- "</t>",
- "<t shadow='1'shadowColor='#000000' font='TahomaB' size='0.65' color='#FFFFFF' align='left'>",
- "<t shadow='1'shadowColor='#000000' font='TahomaB' size='0.60' color='#FFFFFF' align='right'>",
- (actionKeysNamesArray "LookAroundToggle") select (count((actionKeysNamesArray "LookAroundToggle"))) - 1,
- "<t shadow='1'shadowColor='#000000' font='TahomaB' size='0.40' color='#8BFF6B' align='center'>",
- (actionKeysNamesArray "TurnLeft") select 0,
- (actionKeysNamesArray "TurnRight") select 0,
- (actionKeysNamesArray "Handgun") select 0,
- (actionKeysNamesArray "Optics") select (count((actionKeysNamesArray "Optics"))) - 1,
- (actionKeysNamesArray "OpticsMode") select (count((actionKeysNamesArray "OpticsMode"))) - 1,
- (actionKeysNamesArray "LookAround") select (count((actionKeysNamesArray "LookAround"))) - 1
- ];
- _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];
- [
- _titleText,
- [safezoneX,0.50],
- [safezoneY + safezoneH - 1,1],
- 0.5,
- 0
- ] spawn BIS_fnc_dynamicText;
- };
- //play crouch anim to begin with
- player switchMove "aidlpknlmstpsraswpstdnon_player_idlesteady01";
- //while still attached to vehicle
- while {alive player && p2FFV_a && (!p2FFV_exitNow)} do {
- //GetVars
- _slotUsed = nil;
- _slotUsed = FFV_cV getVariable [format["SlotInUse_%1", _slot], nil];
- //Add Instruction Message to Screen
- call _showMsg;
- //Force GUNNER camera mode if enabled via config.sqf
- if (cameraView != "Gunner" && p2FFV_force1pp) then
- {
- player switchCamera "Gunner";
- };
- //Disable Prone
- if ((animationState player) == "amovppnemstpsraswpstdnon" || (animationState player) == "amovppnemstpsraswrfldnon") then {
- player switchMove "aidlpknlmstpsraswpstdnon_player_idlesteady01";
- };
- //Wait until we get the var
- waitUntil{(!isNil '_slotUsed')};
- if (_slotUsed != player && _slotUsed != objNull && str _slotUsed != "<NULL-object>") exitWith {
- //Display 'slot in use' title text
- titleText [("Sorry, that slot has been taken."), "PLAIN DOWN", 1];
- systemChat( "Sorry, that slot has been taken.");
- if (p2FFV_d) then { diag_log("p2FFVDebug: ActionExitLoop: Slot in use"); }; //Debug output
- p2FFV_exitNow = true;
- [_slot,_driverMove] call P2_FFV_DismountToVeh;
- };
- };
- //reset this
- p2FFV_exitNow = false;
- //detach player (if player is dead this should detach the body nice n fast thanks to the low sleep timer above)
- detach player;
- //enable world damage
- player allowDamage true;
- //update attached var
- p2FFV_a = false;
- //Re-apply old dayz_spaceInterrupt (player controls)
- dayz_spaceInterrupt = p2FFV_oldSpaceInt;
- //byPlayer2
Advertisement
Add Comment
Please, Sign In to add comment