/* =============================================================================================================================================
* Game: Grand Theft Auto V
* System: PlayStation 4
* Controller: DualShock 4
* Game Settings: Default Button Mapping
* GPC Author: PerfectHuntr
**/
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* IMPORTANT NOTES:
* The Cheat Codes are only available in the Single-Player story mode! There are no cheats for GTA Online! Auto-Jog and Auto-Sprint will
* still work in the Online mode.
*
* INSTRUCTIONS:
* Push the movement stick forward and press the sprint button once to jog. Press the sprint button a second time to sprint. Release the
* stick to stop jogging/sprinting.
*
* Hold down ACTIVATE (PS4_TOUCH by default, easily swapped) and hit one of the following buttons for the corresponding cheat:
* D-Pad Up = Raise Wanted Level
* D-Pad Down = Lower Wanted Level
* D-Pad Left = Skyfall
* D-Pad Right = Moon Gravity
* L1 = Invincibility for 5 minutes
* L2 = Slow Motion while aiming
* R1 = Max Health & Armor
* R2 = Give Weapons & Ammo
* L3 = Change Weather
* R3 = Recharge Special Ability
* Triangle = Spawn Buzzard Attack Helicopter
* Cross = Spawn Comet sports car
* Square = Spawn Stunt Plane
* Circle = Spawn PCJ-600 motorcycle
*
* You can also turn off your wireless controller if you triple tap the PS button.
**/
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* DEFINES
**/
define RATE_OF_FIRE = 10; // Maximum rate of fire (Range: 1 - 25 [rounds/s])
define SPRINT_BUTTON = PS4_CROSS;
define ACTIVATE = PS4_TOUCH; // COMMENT THIS LINE OUT IF YOU'RE NOT USING A PS4
// define ACTIVATE = XB1_VIEW; // UNCOMMENT THIS LINE
define BX = PS4_CROSS;
define BS = PS4_SQUARE;
define BT = PS4_TRIANGLE;
define BO = PS4_CIRCLE;
define DD = PS4_DOWN;
define DL = PS4_LEFT;
define DU = PS4_UP;
define DR = PS4_RIGHT;
define L1 = PS4_L1;
define L2 = PS4_L2;
define R1 = PS4_R1;
define R2 = PS4_R2;
define L3 = PS4_L3;
define R3 = PS4_R3;
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* DATA SEGMENT
**/
data(
// -[ 00 ]---------------------------[ 00 ]-------------------
R1,R1,BO,R2,DL,DR,DL,DR,DL,DR,-1,-1, // Raise Wanted Level
// -[ 01 ]---------------------------[ 01 ]-------------------
R1,R1,BO,R2,DR,DL,DR,DL,DR,DL,-1,-1, // Lower Wanted Level
// -[ 02 ]---------------------------[ 02 ]-------------------
L1,L2,R1,R2,DL,DR,DL,DR,-1,-1,-1,-1, // Skyfall (runs twice)
// -[ 03 ]---------------------------[ 03 ]-------------------
DL,DL,L1,R1,L1,DR,DL,L1,DL,-1,-1,-1, // Low Gravity
// -[ 04 ]---------------------------[ 04 ]-------------------
DR,BX,DR,DL,DR,R1,DR,DL,BX,BT,-1,-1, // Invincibility
// -[ 05 ]---------------------------[ 05 ]-------------------
BS,L2,R1,BT,DL,BS,L2,DR,BX,-1,-1,-1, // Slow Motion Aiming
// -[ 06 ]---------------------------[ 06 ]-------------------
BO,L1,BT,R2,BX,BS,BO,DR,BS,L1,L1,L1, // Max Health & Armor
// -[ 07 ]---------------------------[ 07 ]-------------------
BT,R2,DL,L1,BX,DR,BT,DD,BS,L1,L1,L1, // Give Weapons & Ammo
// -[ 08 ]---------------------------[ 08 ]-------------------
R2,BX,L1,L1,L2,L2,L2,BS,-1,-1,-1,-1, // Weather
// -[ 09 ]---------------------------[ 09 ]-------------------
BX,BX,BS,R1,L1,BX,DR,DL,BX,-1,-1,-1, // Recharge Special
// -[ 10 ]---------------------------[ 10 ]-------------------
BO,BO,L1,BO,BO,BO,L1,L2,R1,BT,BO,BT, // Spawn Helicopter
// -[ 11 ]---------------------------[ 11 ]-------------------
R1,BO,R2,DR,L1,L2,BX,BX,BS,R1,-1,-1, // Spawn Comet
// -[ 12 ]---------------------------[ 12 ]-------------------
BO,DR,L1,L2,DL,R1,L1,L1,DL,DL,BX,BT, // Spawn Stunt Plane
// -[ 13 ]---------------------------[ 13 ]-------------------
R1,DR,DL,DR,R2,DL,DR,BS,DR,L2,L1,L1 // Spawn PCJ-600
);
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* REMAPPINGS
**/
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* VARIABLES
**/
int menu;
int RF_HoldTime, RF_RestTime; // Amount of time to hold button / rest between buttons during rapid fire
int nTaps_Sprint; // Number of times the SPRINT_BUTTON has been pressed
// Cheat input buttons
int b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12;
int hold, times;
// Timer value for powering off controller with the PS button
int Pwr_Timer;
int nTaps; // Number of times the button has been tapped during 300
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* INITIALIZATION
**/
init {
RF_HoldTime = 500 / RATE_OF_FIRE;
RF_RestTime = RF_HoldTime - 20;
if (RF_RestTime < 0) {
RF_RestTime = 0;
}
}
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* MAIN SCRIPT
**/
main {
// AUTO SPRINT *****************************************************************************************************************************
// Automatically make the character jog (one tap) or sprint (second tap)
// Activate jog or sprint only while the player is moving forward and L2 and R2 are not pressed (useful for driving/flying)
if (get_val(PS4_LY) < -75 && !get_val(PS4_R2) && !get_val(PS4_L2)) {
if (event_release(SPRINT_BUTTON)) {
nTaps_Sprint = nTaps_Sprint + 1;
}
if (nTaps_Sprint % 2 == 1) {
set_val(SPRINT_BUTTON, 100);
}
else if (nTaps_Sprint != 0) {
combo_run(cAutoSprint);
}
}
else {
nTaps_Sprint = 0;
}
// AUTO SPRINT *****************************************************************************************************************************
// CHEAT CODE INPUTS ***********************************************************************************************************************
// Hold down ACTIVATE (PS4_TOUCH by default) and hit one of the following buttons for the corresponding cheat:
// D-Pad Up = Raise Wanted Level
// D-Pad Down = Lower Wanted Level
// D-Pad Left = Skyfall
// D-Pad Right = Moon Gravity
// L1 = Invincibility for 5 minutes
// L2 = Slow Motion while aiming
// R1 = Max Health & Armor
// R2 = Give Weapons & Ammo
// L3 = Change Weather
// R3 = Recharge Special Ability
// Triangle = Spawn Buzzard Attack Helicopter
// Cross = Spawn Comet sports car
// Square = Spawn Stunt Plane
// Circle = Spawn PCJ-600 motorcycle
if (combo_running(cCheatInput)) {
set_val(DU, 0);
set_val(DD, 0);
set_val(DL, 0);
set_val(DR, 0);
set_val(L1, 0);
set_val(L2, 0);
set_val(R1, 0);
set_val(R2, 0);
set_val(L3, 0);
set_val(R3, 0);
set_val(BT, 0);
set_val(BX, 0);
set_val(BS, 0);
set_val(BO, 0);
set_val(ACTIVATE, 0);
}
else if (get_val(ACTIVATE)) {
if (menu) { set_val(ACTIVATE, 0); }
// Check for button presses
hold = TRUE;
if (event_press(DU)) SetCheat(12 * 0); // Raise Wanted Level
else if (event_press(DD)) SetCheat(12 * 1); // Lower Wanted Level
else if (event_press(DL)) SetCheat(12 * 2); // Skyfall
else if (event_press(DR)) SetCheat(12 * 3); // Low Gravity
else if (event_press(L1)) SetCheat(12 * 4); // Invincibility for 5 minutes
else if (event_press(L2)) SetCheat(12 * 5); // Slow Motion while aiming
else if (event_press(R1)) SetCheat(12 * 6); // Give Health & Armor
else if (event_press(R2)) SetCheat(12 * 7); // Give Weapons & Ammo
else if (event_press(L3)) SetCheat(12 * 8); // Change Weather
else if (event_press(R3)) SetCheat(12 * 9); // Fill Special Ability
else if (event_press(BT)) SetCheat(12 * 10); // Spawn Buzzard Attack Helicopter
else if (event_press(BX)) SetCheat(12 * 11); // Spawn Comet
else if (event_press(BS)) SetCheat(12 * 12); // Spawn Stunt Plane
else if (event_press(BO)) SetCheat(12 * 13); // Spawn PCJ-600
if (!hold) combo_restart(cCheatInput);
}
else { menu = FALSE; }
if (!combo_running(cCheatInput) && times > 1) { times = 0; combo_restart(cCheatInput); }
// CHEAT CODE INPUTS ***********************************************************************************************************************
// Turn off wireless controller by triple-tapping PS4_PS with less than 300 between taps
// Timer - Countdown function
if (Pwr_Timer > 0) {
Pwr_Timer = Pwr_Timer - get_rtime();
}
// Timer - Detection of the first tap
if (event_release(PS4_PS)) {
Pwr_Timer = fTapTimer(Pwr_Timer);
if (Pwr_Timer == 0) {
turn_off();
}
}
// Prevent button pass-through
block(PS4_PS, 150);
block(ACTIVATE, 200);
}
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* COMBOS
**/
combo cAutoSprint {
set_val(SPRINT_BUTTON, 100);
wait(RF_HoldTime);
set_val(SPRINT_BUTTON, 0);
wait(RF_RestTime);
set_val(SPRINT_BUTTON, 0);
}
combo cCheatInput {
set_val(b01, 100);
wait(40); wait(40);
set_val(b02, 100);
wait(40); wait(40);
set_val(b03, 100);
wait(40); wait(40);
set_val(b04, 100);
wait(40); wait(40);
set_val(b05, 100);
wait(40); wait(40);
set_val(b06, 100);
wait(40); wait(40);
set_val(b07, 100);
wait(40); wait(40);
set_val(b08, 100);
wait(40); wait(40);
if (b09 == -1) combo_stop(cCheatInput);
else set_val(b09, 100);
wait(40); wait(40);
if (b10 == -1) combo_stop(cCheatInput);
else set_val(b10, 100);
wait(40); wait(40);
if (b11 == -1) combo_stop(cCheatInput);
else set_val(b11, 100);
wait(40); wait(40);
if (b12 == -1) combo_stop(cCheatInput);
else set_val(b12, 100);
wait(40);
}
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* FUNCTIONS
**/
// Timer function for multi-taps
function fTapTimer(timer) {
if (timer <= 0) {
nTaps = 1;
timer = 300; // Start the timer
}
// Timer - Detection of next tap within 300 [ms]
else {
nTaps = nTaps + 1;
timer = 300; // Restart the timer for the next button press
// Timer - 3 button presses detected, proceed to activation/deactivation
if (nTaps == 3) {
nTaps = 0;
timer = 0; // Shut off the timer
}
}
return timer;
}
// Setup the cheat combo
function SetCheat(idx) {
menu = TRUE;
if (idx == 24) times = 2;
else times = 1;
b01 = dchar(idx);
b02 = dchar(idx + 1);
b03 = dchar(idx + 2);
b04 = dchar(idx + 3);
b05 = dchar(idx + 4);
b06 = dchar(idx + 5);
b07 = dchar(idx + 6);
b08 = dchar(idx + 7);
b09 = dchar(idx + 8);
b10 = dchar(idx + 9);
b11 = dchar(idx + 10);
b12 = dchar(idx + 11);
hold = FALSE;
}