//=================================INSTRUCTIONS=====================================
//1:This script is activated/deactivated by double tap PS4_R3/XB1_RS.
//------------------------------------------------------------------------------------------
//2:Deactivate this script when getting into vehicles or aircraft with landing gear.
//if you don't horns will sound off & landing gear will go up & down at random times.
//------------------------------------------------------------------------------------------
//3:When you press PS4_R1/XB1_RB once to take cover, you have (TakeCoverTime = 4000)
//four seconds to get in the position you wish to shoot from. To break cover/leave,
//simply double-click PS4_R1/XB1_RB and this will allow you to immediately sprint.
//------------------------------------------------------------------------------------------
//4:When swimming you need to doulbe-tap PS4_R1/XB1_RB to keep swimming full
//speed when going from the waters surface to dive under water. If you press
//PS4_R1/XB1_RB just once it will dive, but you won't move because pressing once
//is also TakeCoverTime = 4000;. So you will not move for 4 sec.
//------------------------------------------------------------------------------------------
//5:To reload while sprinting, you need to double-tap PS4_CIRCLE/XB1_B.
//If standing still you only need to press once to reload. I would suggest you to
//take out the reload option out of this script on line 87 if you can do without it.
//Leaving this in will allow you to double-tap PS4_CIRCLE/XB1_B to reload.
//However, it comes at the expense of slowing you down while sprinting.
//Reload is slow anyways. I'd suggest you just switch weapons, which is faster than
//reloading. For example, I often switch in between the MG & Special Carbine Rifle.
//With the toupad menu up while sprinting, pressing PS4_CIRCLE/XB1_B will slow you
//as well when backing out of the menu.
//------------------------------------------------------------------------------------------
//6:This is refering to the left analog stick on your controller. On lines 81 & 82
//you can change the -1/1 #'s to higher if you like on (11)/LX & (12)/LY
//If you change them to let's say -50/50 values. That would be 50% away from the
//center or resting position. So it would allow you to tilt your analog stick 50%
//off of center and not sprint. This is fine if it works better for you.
//However, doing so will definitely affect swimming as it would be hard to go in the
//direction you wish. So this is why I put those #'s so low. If you need to slow down
//while using sprint when you get near certain structures and have to navigate around
// things, just simply point your weapon in the direction wanted to get you on track.
//------------------------------------------------------------------------------------------
//GTA 5 AUTO SPRINT FOR FIRST/THIRD PERSON VIEW FPS (TYPE) CONTROL SETTINGS
//define (3) = PS4_R1/XB1_RB
//define (4) = PS4_R2/XB1_RT
//define (5) = PS4_R3/XB1_RS
//define (7) = PS4_L2/XB1_LT
//define (8) = PS4_L3/XB1_LS
//define (11) = PS4_LX/XB1_LX
//define (12) = PS4_LY/XB1_LY
//define (18) = PS4_CIRCLE/XB1_B
define TakeCoverTime = 4000; // you can adjust for taking cover with (3).
//------------------------------------------------------------------------------------------
int RunGearSwitch; //Don't change
int Button_Timing; //Don't change
int Button_State = 0; //Don't change
int Double_Tap_Gap = 200; //Gap in between taps. Change to what's best.
int Button_Timing1; //Don't change
int Button_State1 = 0; //Don't change
int Double_Tap_Gap1 = 200; //Gap in between taps. Change to what's best.
//------------------------------------------------------------------------------------------
init {
RunGearSwitch = get_pvar(SPVAR_1, 1, 2, 1);
}
//------------------------------------------------------------------------------------------
main{ //(Main start)
//AUTO SPRINT================================================================
if(DoubleTap(5) == TRUE) { //Activates/Deactivates script.
if(RunGearSwitch == 2) {
RunGearSwitch = 1;
set_pvar(SPVAR_1, RunGearSwitch);
combo_run(RumbleNotifier_1);
set_led(LED_3, 0);
} else if (RunGearSwitch == 1) {
RunGearSwitch = 2;
set_pvar(SPVAR_1, RunGearSwitch);
combo_run(RumbleNotifier_2);
set_led(LED_3, 1);
}
}
if (RunGearSwitch == 2) { //For my needs I like(11)&(12)#'s
if (get_val(12) < -1 || abs(get_val(11)) > 1 ^^ //at -1/1, adjust those #'s to what
abs(get_val(11)) < -1 ) { //works best. Changing these #'s
set_val(8, 100); //too high will affect swimming.
} else {
set_val(8, 0);
}
if (get_val(7) || get_val(4) || get_val(18)) { //If remove reload/back. || get_val(18)
set_val(8, 0);
}
}
if (event_press(3)) { combo_run(TakeCover); }
//DOUBLE TAP R1/RB/(3) TO VOID TAKE COVER====================================
if (DoubleTap1(3) == TRUE) {
combo_stop(TakeCover);
}
} //End Of Main
//COMBOS=====================================================================
combo TakeCover {
set_val (8, 0);
wait (TakeCoverTime);
}
combo RumbleNotifier_1 {
set_rumble (RUMBLE_A, 51);
wait (300);
reset_rumble();
}
combo RumbleNotifier_2 {
set_rumble (RUMBLE_B, 51);
wait (300);
set_rumble (RUMBLE_B, 0);
wait (300);
set_rumble (RUMBLE_B, 51);
wait (400);
reset_rumble();
}
//FUNCTIONS==================================================================
//Functions must be at the bottom of the page.
function DoubleTap(Button) {
//Detect Double-Tap
if(Button_State == 0) {
if(get_val(Button)) Button_State = 1;
} else if(Button_State == 1) {
if(!get_val(Button)) { Button_Timing = 0; Button_State = 2; }
} else if(Button_State == 2) {
if(get_val(Button)) { Button_State = 1; return TRUE; }
Button_Timing = Button_Timing + get_rtime();
if(Button_Timing > Double_Tap_Gap) Button_State = 0;
}
}
function DoubleTap1(Button) {
//Detect Double-Tap
if(Button_State1 == 0) {
if(get_val(Button)) Button_State1 = 1;
} else if(Button_State1 == 1) {
if(!get_val(Button)) { Button_Timing1 = 0; Button_State1 = 2; }
} else if(Button_State1 == 2) {
if(get_val(Button)) { Button_State1 = 1; return TRUE; }
Button_Timing1 = Button_Timing1 + get_rtime();
if(Button_Timing1 > Double_Tap_Gap1) Button_State1 = 0;
}
}