Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma METAINFO("AwesomeAntiRecoil", 1, 0, "bonefisher")
- #include <display.gph>
- /* Special credits goes out to AryanX for a awesome anti-recoil script!*/
- #define float fix32
- #define DISPLAY_TIME 5000 // How long in ms to show on display
- float recoil_1 = 49.0;
- float recoil_2 = 25.0;
- float recoil_3 = 15.00;
- //Anti Recoil
- bool bUseAntiRecoil = TRUE;
- float ARecoil_H_Standing = 0.0;// Change horizontal force add negative if needed.
- float ARecoil_V_Standing = 30.0;//Change vertical pull force
- uint16 ARecoilDelay = 75;//Change delay after trigger is pulled to engage anti-recoil.
- //Percent of anti ARecoil to always apply regardless of aim movement
- float MinARecoilPercent = 30.0;
- float StickNoise = 6.32;
- bool run_flag;
- bool rapidfire;
- main {
- // ADS+Dpad Up
- if (is_active(BUTTON_8) && event_active(BUTTON_10)) {
- if (ARecoil_V_Standing == recoil_1) {
- ARecoil_V_Standing = recoil_2;
- ARecoil_H_Standing = 0.0;
- ARecoilDelay = 75;
- MinARecoilPercent = 30.0;
- display_overlay(_2_|BOTTOM_DOT,DISPLAY_TIME);
- } else {
- ARecoil_V_Standing = recoil_1;
- ARecoil_H_Standing = 9.0;
- ARecoilDelay = 115;
- MinARecoilPercent = 45.0;
- display_overlay(_1_|BOTTOM_DOT,DISPLAY_TIME);
- }
- }
- // ADS+Dpad Down
- if (is_active(BUTTON_8) && event_active(BUTTON_11)) {
- rapidfire = !rapidfire;
- ARecoil_V_Standing = recoil_3;
- display_overlay(_3_|BOTTOM_DOT,DISPLAY_TIME);
- }
- // VIEW + RT to toggle rapidfire
- if (is_active(BUTTON_2) && event_active(BUTTON_5)) {
- rapidfire = !rapidfire;
- }
- if(rapidfire && get_actual(BUTTON_5)) {
- combo_run(Rapidfire);
- }
- if (!get_actual(BUTTON_5) && !get_actual(BUTTON_8) && !run_flag &&
- get_val(STICK_2_Y) < -99.0 && time_active(STICK_2_Y) > 300) {
- run_flag = 1;
- combo_run(run);
- } else if (get_val(STICK_2_Y) > -99.0 && event_release(STICK_2_Y)) {
- run_flag = 0;
- }
- //////////////////////////////////////////////////////////////////////////
- //Anti Recoil
- //////////////////////////////////////////////////////////////////////////
- if (bUseAntiRecoil)
- {
- if (get_actual(BUTTON_8) &&get_actual(BUTTON_5) && time_active(BUTTON_5) >= ARecoilDelay)
- {
- if (abs(get_actual(STICK_1_X)) < StickNoise) set_val(STICK_1_X, 0.0);
- if (abs(get_actual(STICK_1_Y)) < StickNoise) set_val(STICK_1_Y, 0.0);
- if (abs(get_actual(STICK_2_X)) < StickNoise) set_val(STICK_2_X, 0.0);
- if (abs(get_actual(STICK_2_Y)) < StickNoise) set_val(STICK_2_Y, 0.0);
- if (get_actual(BUTTON_8) && get_val(BUTTON_5))
- {
- AntiRecoil(STICK_1_X, ARecoil_H_Standing);
- AntiRecoil(STICK_1_Y, ARecoil_V_Standing);
- }
- }
- }
- }
- void AntiRecoil(uint8 AxisToApply, float ARecoilToApply)
- {
- float CurrentX = get_val(STICK_1_X);
- float CurrentY = get_val(STICK_1_Y);
- float MinARecoilFactor = MinARecoilPercent / 100.0;
- float MinARecoilToApply = MinARecoilFactor * ARecoilToApply;
- //This sets the ARecoil to be dependent on both X and Y axis movement. With more emphasis on Y
- float MovementARecoilToApply = (1.0 - MinARecoilFactor) * ((ARecoilToApply * (100.0 - sqrt(CurrentX*CurrentX + CurrentY*CurrentY))) / (100.0 + abs(CurrentX) + (CurrentY*CurrentY*0.5)));
- set_val(AxisToApply, MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply));
- }
- combo run
- {
- set_val(BUTTON_9, 0.0);
- wait(200);
- set_val(BUTTON_9, 100.0);
- wait(400);
- set_val(BUTTON_9, 0.0);
- }
- combo Rapidfire {
- set_val(BUTTON_5, 100.0);
- wait(28);
- set_val(BUTTON_5, 0.0);
- wait(16);
- set_val(BUTTON_5, 0.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement