//DEFINES
define X = PS4_CROSS;
define O = PS4_CIRCLE;
define S = PS3_SQUARE;
define Y = PS4_TRIANGLE;
define L1 = PS4_L1;
define R1 = PS4_R1;
define R3 = PS4_R3;
define R2 = PS4_R2;
define OPTIONS = PS4_OPTIONS;
define RATE_OF_FIRE = 6;
define RAPIDFIRE_BUTTON = PS4_R2;
//INT
int a, b, c, d, i, z, change, delay, location, touched, menu, flash, blocked;
int fire_button, scope_button;
int hold_time, rest_time;
int combo_HeavyCannon = FALSE;
int combo_Spamm = FALSE;
int combo_RapidFire = FALSE;
int combo_flash = FALSE;
int combo_cooldown = FALSE;
int combo_leveling = FALSE;
int combo_tbag = FALSE;
//INIT
init {
a = get_pvar(PVAR_1, 0, 1, 0);
b = get_pvar(PVAR_2, 0, 1, 0);
c = get_pvar(PVAR_3, 0, 1, 0);
d = get_pvar(PVAR_4, 0, 1, 0);
if (a == 0 && b == 1 && c == 0 && d == 0) { i = 0; }
else if (a == 0 && b == 1 && c == 1 && d == 0) { i = 1; }
else if (a == 0 && b == 0 && c == 1 && d == 0) { i = 2; }
else if (a == 1 && b == 0 && c == 0 && d == 0) { i = 3; }
else if (a == 1 && b == 0 && c == 1 && d == 0) { i = 4; }
else if (a == 0 && b == 0 && c == 0 && d == 1) { i = 5; }
else if (a == 1 && b == 1 && c == 1 && d == 1) { i = 6; }
z = 0;
color(i);
if(get_console() == PIO_AUTO) {
fire_button = 3;
scope_button = 6;
} else {
fire_button = 4;
scope_button = 7;
}
hold_time = 500 / RATE_OF_FIRE;
rest_time = hold_time - 20;
if(rest_time < 0) rest_time = 0;
}
//MAIN
main {
if (Swipe()) { change = 1; }
if (i < 0) { i = 6; }
else if (i > 6) { i = 0; }
if (change) { change = 0; color(i); }
if (get_val(PS4_PS) && get_ptime(PS4_PS) > 3000) { set_val(PS4_PS, 0); turn_off(); }
if (z == 0) {
if(get_val(X) && get_val(O)) {
menu = !menu;
z = 1;
}
}
if ((get_lval(PS4_L2)) && (event_press(PS4_R3))) {
blocked = !blocked
}
if(get_val(RAPIDFIRE_BUTTON) && (!combo_HeavyCannon) && (!blocked)) {
combo_run(RapidFire);
}
else if(combo_running(RapidFire)) {
combo_stop(RapidFire);
}
if(get_val(S) && get_val(X)) {
combo_run(Leveling);
}
else {
combo_stop(Leveling);
}
if(get_val(RAPIDFIRE_BUTTON) && get_val(R3)) {
combo_run(HeavyCannon);
} else if(combo_running(HeavyCannon)) {
combo_stop(HeavyCannon);
}
if (menu) {
if (z == 0) {
if(get_val(X) && get_val(O)) {
if(get_val(S) && get_val(Y)) {
flash = !flash;
z = 1;
cooldown = !cooldown;
}
}
}
}
if (menu) {
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
set_led(LED_4, 0);
}
if(combo_Spamm) {
combo_run(Spamm);
}
else {color(i)}
if(get_val(OPTIONS) && get_val(R3)) {
combo_Spamm = !combo_Spamm;
}
if(combo_flash) {
combo_run(Flash);
}
if (!cooldown) {
combo_run(cooldown)
}
else {
combo_stop(cooldown)
}
}
//COMBOS
combo Leveling {
set_val(S, 100);
wait(750);
set_val(S, 0);
wait(200)
}
combo RapidFire {
set_val(RAPIDFIRE_BUTTON, 100);
wait(hold_time);
set_val(RAPIDFIRE_BUTTON, 0);
wait(rest_time);
set_val(RAPIDFIRE_BUTTON, 0);
}
combo HeavyCannon {
set_val(RAPIDFIRE_BUTTON, 100);
wait(4000);
set_val(RAPIDFIRE_BUTTON, 0);
wait(40);
}
combo Spamm {
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
set_led(LED_4, 0);
set_val(X, 100);
wait(40);
set_val(X, 0);
wait(100);
set_val(X, 100);
wait(40);
set_val(X, 0);
wait(100);
set_val(R2, 100);
wait(100);
set_val(R2, 0);
wait(100);
}
combo Flash{
i = i-1;
wait(100);
}
combo cooldown {
wait(200);
z = 0;
}
//FUNCTIONS
function color(a) {
if (i == 0) { fSetLED(0,1,0,0); } // Red
else if (i == 1) { fSetLED(0,1,1,0); } // Amber
else if (i == 2) { fSetLED(0,0,1,0); } // Green
else if (i == 3) { fSetLED(1,0,0,0); } // Blue
else if (i == 4) { fSetLED(1,0,1,0); } // Cyan
else if (i == 5) { fSetLED(0,0,0,1); } // Magenta
else if (i == 6) { fSetLED(1,1,1,1); } // White
}
function fSetLED(a, b, c, d) {
set_led(LED_1, a);
set_led(LED_2, b);
set_led(LED_3, c);
set_led(LED_4, d);
set_pvar(PVAR_1, a);
set_pvar(PVAR_2, b);
set_pvar(PVAR_3, c);
set_pvar(PVAR_4, d);
}
function Swipe() {
if (!ps4_touchpad(PS4T_P1)) {
touched = FALSE;
delay = 0;
return 0;
}
else { touched = TRUE; }
delay = delay - get_rtime();
if (delay <= 0) {
location = 0;
delay = 0;
}
if (menu) {
if (touched) {
if (delay > 0) {
if (location > 50) {
if (get_val(PS4_TOUCHY) < -50) {
delay = 0;
i = i+1;
return 1;
}
}
else if (location < -50) {
if (get_val(PS4_TOUCHY) > 50) {
delay = 0;
i = i-1;
return 1;
}
}
}
else if (abs(get_val(PS4_TOUCHY)) > 50) {
location = get_val(PS4_TOUCHY);
delay = 300;
}
}
return 0;
}
}