Jump to content

TRY This Rapid-Fire GPC Script I Made for Cronus Zen. Current Rapid-Fire Speed & Other Functions work best on Xbox Series S/X Backward Compatibility Version of GTA4 in Multiplayer on Foot.


Recommended Posts

Xboxplayer2

Copy & Paste This GPC. Script below in your Zen Studio Compile then Compile & Program it to your device. Rapid-fire & Auto-run are OFF by defualt so press the toggles below to turn them on.

YOU NEED TO TURN ON VIBRATION IN GTA4 PAUSE SETTINGS AND ON YOUR CONSOLES SETTINGS FOR RAPID-FIRE TO BE AS FAST AS POSSIBLE. I DISABLED THE PHYSICAL VIBRATION IN SCRIPT.

Toggle Rapid-fire on or off by pressing RB + Y

Toggle Auto-run on/off by pressing LB + DPAD_DOWN

You never need to turn your rapid-fire off in this script even while driving or using grenades so enjoy surprising everyone with rapid-fire. 

 

Copy paste this into your compiler on zen studio:

 

////////////////////////////////////////////////////////////////////////////////
//GTA4 SCRIPT adjusted for Xbox Series S/X
////////////////////////////////////////////////////////////////////////////////
//Toggle Rapid-Fire on/off by pressing Y + RB
//Toggle Auto-Run on/off by pressing LB + DPAD DOWN
////////////////////////////////////////////////////////////////////////////////
//Vibration must be turned on in GTA4 pause settings and vibration must be turned on in your xbox settings for FAST RAPID FIRE (I disbaled physical vibration so you won't feel any)
////////////////////////////////////////////////////////////////////////////////
//To Adjust Rapid-Fire speed change the loopSpeed or change shotsPerSec=32; under // raw i/o

int loopSpeed = -1.499999999999999889;

//-------------------------------------------
// 5-phase => total=300 => ends at LY=(0 - 26)
int windowActive=0;
int windowTimer=0;
int windowDuration=600;

int totalCycleTime=350;
int subPhaseTime=0;
int strafeActive=0;
int subPhase=0;
int rampOrHold=0;
int stepCount=0;
int leftover=0;
int subPhaseTimer=0;
int fastFinish=0;
int currentLY=0;

// repeated LX cycle => toggled by LS => only if tierEnabled=1
int rxCycleActive=0;
int rxCycleStep=0;
int rxCycleTimer=0;
int stepDuration=10;
int rxCyclePaused=0;
int rxCycleMaster=1; // ON by default

//-------------------------------------------
// toggles => (Y+RB) => RT RapidFire => only if LT>0
int rapidFireEnabled=0;
int rapidFireToggleLock=0;

// Tier => (LB + DPad DOWN) => ±67/77/(0 - 100)
int tierEnabled=0;
int tierToggleLock=0;
// tierHoldA => if physically T4 => if(tierHoldA=1 => A=100 => else => A=0)
int tierHoldA=1;

//-------------------------------------------
// Aim Accel => only clamp if physically >=92 => 100ms => then pass
// states => 0 => not started, 1 => timing, 2 => freed
int accelThreshold=92;
int clampValue=91;
int accelTimeRequired=100;

int rxState=0;
int ryState=0;
int rxTimer=0;
int ryTimer=0;

// We'll define these globally so older GPC won't complain
int absRX_=0, absRY_=0;

// raw i/o
int rawLX=0, rawLY=0, rawRX=0, rawRY=0;
int finalLXtmp=0, finalLYtmp=0;
int finalRXtmp=0, finalRYtmp=0;
int sprintActive=0;
int elapsed=0;
int physLB=0, physRB=0, physLT=0, physRT=0, physA=0, physDDown=0;
int absLX_=0, absLY_=0; // for Tier
int shotTimer=0;
int shotsPerSec=32;
int shotsDelay=0;
int rumble_small=0, rumble_big=0;

// combos => toggles
combo TierOnRumble {
    set_rumble(1,100);
    wait(10);
    set_rumble(1,0);
}
combo TierOffRumble {
    set_rumble(1,60);
    wait(10);
    set_rumble(1,0);
}
combo RapidOnRumble {
    set_rumble(1,100);
    wait(10);
    set_rumble(1,0);
}
combo RapidOffRumble {
    set_rumble(1,60);
    wait(10);
    set_rumble(1,0);
}

// Rapid-Fire => 93->94->95
combo RampUp93to95 {
    set_val(XB1_RT,93);
    wait(1);
    set_val(XB1_RT,94);
    wait(1);
    set_val(XB1_RT,95);
    wait(1);
}

//-------------------------------------------
// main
//-------------------------------------------
main {
    vm_tctrl(loopSpeed);

    elapsed= get_rtime();
    if(shotsPerSec<1) shotsPerSec=1;
    shotsDelay= 1000 / shotsPerSec;

    // read raw
    rawLX= get_val(XB1_LX);
    rawLY= get_val(XB1_LY);
    rawRX= get_val(XB1_RX);
    rawRY= get_val(XB1_RY);

    physLB   = get_val(XB1_LB);
    physRB   = get_val(XB1_RB);
    physLT   = get_val(XB1_LT);
    physRT   = get_val(XB1_RT);
    physA    = get_val(XB1_A);
    physDDown= get_val(XB1_DOWN);

    rumble_small= get_rumble(0);
    rumble_big  = get_rumble(1);

    //-------------------------------------------
    // (Y+RB) => toggles rapidFireEnabled => only if LT>0 => 93->94->95
    //-------------------------------------------
    if(get_val(XB1_Y)>99 && get_val(XB1_RB)>99) {
        if(!rapidFireToggleLock) {
            rapidFireEnabled= !rapidFireEnabled;
            rapidFireToggleLock=1;
            if(rapidFireEnabled==1) combo_run(RapidOnRumble);
            else                    combo_run(RapidOffRumble);
        }
    } else {
        rapidFireToggleLock=0;
    }

    //-------------------------------------------
    // Tier => (LB + DPad DOWN)
    //-------------------------------------------
    if(physLB>99 && physDDown>99) {
        if(!tierToggleLock) {
            tierEnabled= !tierEnabled;
            tierToggleLock=1;
            if(tierEnabled==1) combo_run(TierOnRumble);
            else               combo_run(TierOffRumble);
        }
    } else {
        tierToggleLock=0;
    }

    //-------------------------------------------
    // LS => in-game LS=100 => if physically T4 => toggle tierHoldA
    // if tierEnabled=1 => toggle rxCycleMaster
    //-------------------------------------------
    if(event_press(XB1_LS)) {
        set_val(XB1_LS,100);
        absLX_= abs(rawLX);
        absLY_= abs(rawLY);
        if(absLX_>=78 || absLY_>=78) {
            tierHoldA= !tierHoldA;
        }
        if(tierEnabled==1) {
            rxCycleMaster= !rxCycleMaster;
            if(rxCycleMaster==1) combo_run(RapidOnRumble);
            else                 combo_run(RapidOffRumble);
        }
    }

    //-------------------------------------------
    // 1500 ms window => event_press(LT)
    //-------------------------------------------
    if(event_press(XB1_LT)) {
        windowActive=1;
        windowTimer=0;
    }
    if(windowActive==1) {
        windowTimer+= elapsed;
        if(windowTimer> windowDuration) {
            windowActive=0;
        } else {
            if(strafeActive==0 && physLT>0) {
                if(abs(rawLX)<26 && abs(rawLY)<26) {
                    strafeActive=1;
                    subPhase=1;
                    rampOrHold=0;
                    fastFinish=0;
                    currentLY=0;
                    subPhaseTime= (totalCycleTime/5);
                    stepCount=26;
                    leftover= subPhaseTime - 26;
                    subPhaseTimer=0;
                }
            }
        }
    }

    //-------------------------------------------
    // 5-phase => LY => total=300 => ends at (0 - 26)
    //-------------------------------------------
    if(strafeActive==1) {
        if(abs(rawLX)>25 || abs(rawLY)>25) {
            fastFinish=1;
        }
        if(physLT<1) {
            fastFinish=1;
        }

        subPhaseTimer+= elapsed;
        while(subPhaseTimer>=1 && strafeActive==1) {
            subPhaseTimer-=1;
            if(rampOrHold==0) {
                stepCount--;
                if(subPhase==1) {
                    currentLY--;
                }
                else if(subPhase==2) {
                    currentLY++;
                }
                else if(subPhase==3) {
                    currentLY++;
                }
                else if(subPhase==4) {
                    currentLY--;
                }
                else if(subPhase==5) {
                    currentLY--;
                }
                else {
                    // comment => no code
                }
                if(stepCount<=0) {
                    rampOrHold=1;
                    stepCount=0;
                }
            }
            else {
                leftover--;
                if(leftover<=0) {
                    subPhase++;
                    if(subPhase>5) {
                        strafeActive=0;
                        subPhase=0;
                    }
                    else {
                        rampOrHold=0;
                        stepCount=26;
                        leftover= (subPhaseTime) - 26;
                    }
                }
            }
            if(fastFinish==1 && strafeActive==1) {
                strafeActive=0;
                subPhase=0;
                currentLY=0;
                leftover=0;
                subPhaseTimer=0;
                break;
            }
        }
        if(strafeActive==1) {
            set_val(XB1_LY, currentLY);
        } else {
            set_val(XB1_LY, currentLY);
        }
    }
    else {
        // comment => no code
    }

    //-------------------------------------------
    // repeated LX cycle => if rxCycleMaster=1
    //-------------------------------------------
    if(rxCycleMaster==1) {
        if(rxCycleActive==0) {
            if(physLT>0 && abs(rawRX)>25) {
                rxCycleActive=1;
                rxCycleStep=1;
                rxCycleTimer=0;
                rxCyclePaused=0;
            }
        }
        else {
            if(physLT<1 || abs(rawRX)<26) {
                rxCycleActive=0;
                rxCycleStep=0;
                rxCycleTimer=0;
                rxCyclePaused=0;
                set_val(XB1_LX,0);
            } else {
                if(abs(rawLX)>25 || abs(rawLY)>25) {
                    rxCyclePaused=1;
                } else {
                    rxCyclePaused=0;
                }

                if(rxCyclePaused==1) {
                    set_val(XB1_LX, rawLX);
                }
                else {
                    rxCycleTimer+= elapsed;
                    if(rxCycleTimer>=stepDuration) {
                        rxCycleTimer=0;
                        rxCycleStep++;
                        if(rxCycleStep>4) {
                            rxCycleStep=1;
                        }
                    }
                    if(rxCycleStep==1) {
                        set_val(XB1_LX, (0 - 26));
                    }
                    else if(rxCycleStep==2) {
                        set_val(XB1_LX, 0);
                    }
                    else if(rxCycleStep==3) {
                        set_val(XB1_LX, 26);
                    }
                    else if(rxCycleStep==4) {
                        set_val(XB1_LX, 0);
                    }
                }
            }
        }
    }
    else {
        // rxCycleMaster=0 => comment => no code
    }

    //-------------------------------------------
    // Tier => if ON => ±67/77/(0 - 100) => T4 => if(tierHoldA=1 => A=100 => else => A=0
    //-------------------------------------------
    finalLXtmp= rawLX;
    finalLYtmp= rawLY;
    if(tierEnabled==1) {
        absLX_= abs(finalLXtmp);
        absLY_= abs(finalLYtmp);
        sprintActive=0;

        if(absLX_>=78) {
            if(finalLXtmp>0) finalLXtmp=100;
            else             finalLXtmp=(0 - 100);
            sprintActive=1;
        }
        else if(absLX_>=68) {
            if(finalLXtmp>0) finalLXtmp=77;
            else             finalLXtmp=(0 - 77);
        }
        else if(absLX_>=25) {
            if(finalLXtmp>0) finalLXtmp=67;
            else             finalLXtmp=(0 - 67);
        }

        if(absLY_>=78) {
            if(finalLYtmp>0) finalLYtmp=100;
            else             finalLYtmp=(0 - 100);
            sprintActive=1;
        }
        else if(absLY_>=68) {
            if(finalLYtmp>0) finalLYtmp=77;
            else             finalLYtmp=(0 - 77);
        }
        else if(absLY_>=25) {
            if(finalLYtmp>0) finalLYtmp=67;
            else             finalLYtmp=(0 - 67);
        }

        if(sprintActive==1) {
            if(tierHoldA==1) {
                set_val(XB1_A,100);
            } else {
                set_val(XB1_A,0);
            }
        } 
        else {
            // T1..3 => partial => no forced A
            set_val(XB1_A,0);
        }
    }
    else {
        // tierEnabled=0 => comment => no code
    }

    //-------------------------------------------
    // Rapid-Fire => if RT>0 & LT>0 & rapidFireEnabled=1 => 93->94->95
    // else pass raw
    //-------------------------------------------
    if(physRT>0) {
        if(physLT>0 && rapidFireEnabled==1) {
            set_val(XB1_RT,93);
            shotTimer+= elapsed;
            if(shotTimer>= (1000/shotsPerSec)) {
                shotTimer=0;
                combo_stop(RampUp93to95);
                combo_run(RampUp93to95);
            }
        } else {
            set_val(XB1_RT, physRT);
        }
    } 
    else {
        set_val(XB1_RT,0);
        combo_stop(RampUp93to95);
    }

    //-------------------------------------------
    // NEW Aim Accel => only clamp if physically ≥92 => 100ms => then pass
    //-------------------------------------------
    finalRXtmp= rawRX;
    finalRYtmp= rawRY;

    // use absRX_, absRY_ declared globally
    absRX_= abs(finalRXtmp);
    absRY_= abs(finalRYtmp);

    if(physLT>0) {
        //---------------------------------------
        // handle RX
        //---------------------------------------
        if(absRX_< accelThreshold) {
            // below 92 => pass raw => reset state
            rxState=0;
            rxTimer=0;
            // pass raw => finalRXtmp= rawRX
        }
        else {
            // absRX_≥92 => check state
            if(rxState==0) {
                // start => clamp => state=1 => timer=0
                rxState=1;
                rxTimer=0;
                if(finalRXtmp>0) finalRXtmp= clampValue;
                else             finalRXtmp=(0 - clampValue);
            }
            else if(rxState==1) {
                // if user drops below 92 => reset
                if(absRX_< accelThreshold) {
                    rxState=0;
                    rxTimer=0;
                }
                else {
                    rxTimer+= elapsed;
                    if(rxTimer>= accelTimeRequired) {
                        rxState=2; // free
                    }
                    if(rxState==1) {
                        // clamp
                        if(finalRXtmp>0) finalRXtmp= clampValue;
                        else             finalRXtmp=(0 - clampValue);
                    }
                    else {
                        // state=2 => pass raw => finalRXtmp= rawRX
                    }
                }
            }
            else if(rxState==2) {
                // pass raw => finalRXtmp= rawRX
            }
        }

        //---------------------------------------
        // handle RY
        //---------------------------------------
        if(absRY_< accelThreshold) {
            ryState=0;
            ryTimer=0;
            // pass raw => finalRYtmp= rawRY
        }
        else {
            if(ryState==0) {
                ryState=1;
                ryTimer=0;
                if(finalRYtmp>0) finalRYtmp= clampValue;
                else             finalRYtmp=(0 - clampValue);
            }
            else if(ryState==1) {
                if(absRY_< accelThreshold) {
                    ryState=0;
                    ryTimer=0;
                }
                else {
                    ryTimer+= elapsed;
                    if(ryTimer>= accelTimeRequired) {
                        ryState=2;
                    }
                    if(ryState==1) {
                        if(finalRYtmp>0) finalRYtmp= clampValue;
                        else             finalRYtmp=(0 - clampValue);
                    }
                    else {
                        // state=2 => pass raw
                    }
                }
            }
            else if(ryState==2) {
                // pass raw => finalRYtmp= rawRY
            }
        }
    }
    else {
        // LT=0 => pass raw => reset
        rxState=0; rxTimer=0;
        ryState=0; ryTimer=0;
    }

    //-------------------------------------------
    // finalize => if state=2 => pass raw => else clamp or pass raw
    //-------------------------------------------
    if(rxState==2) {
        finalRXtmp= rawRX;
    } 
    else if(rxState==1) {
        // we set finalRXtmp above => clamp
    }
    else {
        // state=0 => pass raw
        finalRXtmp= rawRX;
    }

    if(ryState==2) {
        finalRYtmp= rawRY;
    }
    else if(ryState==1) {
        // clamp => already set
    }
    else {
        finalRYtmp= rawRY;
    }

    // set
    set_val(XB1_RX, finalRXtmp);
    set_val(XB1_RY, finalRYtmp);

    // kill normal rumble => combos remain
    set_rumble(0,0);
    set_rumble(1,0);
}

Edited by Xboxplayer2
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.