i need help in script Rapidfire
17 posts
• Page 1 of 2 • 1, 2
i need help in script Rapidfire
hi,i need help in script Rapidfire
1/ (.) in keyboard on/off for grren LED_3 if on >>> i done that
2/ add button BUTTON_14 for on / off > i need only work when i press fast(grren LED_3 if on),but when i hold the button like 0.3sce dose not turn on/ off
-------------------------------------------------------
mean i want (.) in keyboard on/off the script + then i press triangle to swep the weapon it stop (rapidfire for 1st weapon and 2nd no rapidfire ) only work when i press triangle fast , and do not work when i hold triangle )
-------------------------------------------------------
1/ (.) in keyboard on/off for grren LED_3 if on >>> i done that
2/ add button BUTTON_14 for on / off > i need only work when i press fast(grren LED_3 if on),but when i hold the button like 0.3sce dose not turn on/ off
-------------------------------------------------------
mean i want (.) in keyboard on/off the script + then i press triangle to swep the weapon it stop (rapidfire for 1st weapon and 2nd no rapidfire ) only work when i press triangle fast , and do not work when i hold triangle )
-------------------------------------------------------
- Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
#include <display.gph>
#include <keyboard.gph>
#include "xkeys.gph"
uint8 KEYPERIOD;
int Enabled = FALSE;
init {
KEYPERIOD=xkeys_add(KEY_PADPERIOD); /// .
}
main {
if (xkeys_event_active(KEYPERIOD)){ ///////// ON/OFF (.)
if(Enabled) {
Enabled = FALSE;
led_reset();
display_overlay(_X_, 2000);
} else if(!Enabled) {
led_reset();
Enabled = TRUE;
led_set(LED_3, -1.0, 0); // green On
display_overlay(_R_, 2000);
}
}
if (Enabled) {
if(get_val(BUTTON_5)) {
combo_run(Rapidfire);
}
}
}
combo Rapidfire {
set_val(BUTTON_5, 100.0);
wait(59);
set_val(BUTTON_5, 0.0);
wait(37);
}
Last edited by TheOne on Mon May 27, 2019 1:51 am, edited 2 times in total.
-
TheOne - Sergeant First Class
- Posts: 21
- Joined: Mon Aug 13, 2018 7:43 pm
Re: i need help in script Rapidfire
- Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
#include <display.gph>
#include <keyboard.gph>
#include "xkeys.gph"
uint8 KEYPERIOD;
bool rapidfire;
init {
KEYPERIOD=xkeys_add(KEY_PADPERIOD);
}
main {
key_passthru();
if(xkeys_event_release(KEYPERIOD)) { // On release
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(get_val(BUTTON_5) && rapidfire) { combo_run(RapidFire); }
}
combo RapidFire {
set_val(BUTTON_5, 100.0);
wait(59);
set_val(BUTTON_5, 0.0);
wait(37);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: i need help in script Rapidfire
still the same
-
TheOne - Sergeant First Class
- Posts: 21
- Joined: Mon Aug 13, 2018 7:43 pm
Re: i need help in script Rapidfire
Sorry I didn't understand correctly here you go.
- Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
#include <display.gph>
#include <keyboard.gph>
#include "xkeys.gph"
uint8 KEYPERIOD;
bool rapidfire;
init {
KEYPERIOD=xkeys_add(KEY_PADPERIOD);
}
main {
key_passthru();
if(xkeys_event_release(KEYPERIOD)) { // On release
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(event_release(BUTTON_14) && time_active(BUTTON_14) < 300) {
if(rapidfire) {
rapidfire = !rapidfire;
led_reset();
display_overlay(_X_, 2000);
}
}
if(get_val(BUTTON_5) && rapidfire) { combo_run(RapidFire); }
}
combo RapidFire {
set_val(BUTTON_5, 100.0);
wait(59);
set_val(BUTTON_5, 0.0);
wait(37);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: i need help in script Rapidfire
Mad wrote:Sorry I didn't understand correctly here you go.
- Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
#include <display.gph>
#include <keyboard.gph>
#include "xkeys.gph"
uint8 KEYPERIOD;
bool rapidfire;
init {
KEYPERIOD=xkeys_add(KEY_PADPERIOD);
}
main {
key_passthru();
if(xkeys_event_release(KEYPERIOD)) { // On release
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(event_release(BUTTON_14) && time_active(BUTTON_14) < 300) {
if(rapidfire) {
rapidfire = !rapidfire;
led_reset();
display_overlay(_X_, 2000);
}
}
if(get_val(BUTTON_5) && rapidfire) { combo_run(RapidFire); }
}
combo RapidFire {
set_val(BUTTON_5, 100.0);
wait(59);
set_val(BUTTON_5, 0.0);
wait(37);
}
when i press triangle to swep the weapon it stop , but when i press triangle agine dose not turn on ?
-
TheOne - Sergeant First Class
- Posts: 21
- Joined: Mon Aug 13, 2018 7:43 pm
Re: i need help in script Rapidfire
- Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
#include <display.gph>
#include <keyboard.gph>
#include "xkeys.gph"
uint8 KEYPERIOD;
bool rapidfire;
init {
KEYPERIOD=xkeys_add(KEY_PADPERIOD);
}
main {
key_passthru();
if(xkeys_event_release(KEYPERIOD)) { // On release
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(event_release(BUTTON_14) && time_active(BUTTON_14) < 300) {
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(get_val(BUTTON_5) && rapidfire) { combo_run(RapidFire); }
}
combo RapidFire {
set_val(BUTTON_5, 100.0);
wait(59);
set_val(BUTTON_5, 0.0);
wait(37);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: i need help in script Rapidfire
Mad wrote:
- Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
#include <display.gph>
#include <keyboard.gph>
#include "xkeys.gph"
uint8 KEYPERIOD;
bool rapidfire;
init {
KEYPERIOD=xkeys_add(KEY_PADPERIOD);
}
main {
key_passthru();
if(xkeys_event_release(KEYPERIOD)) { // On release
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(event_release(BUTTON_14) && time_active(BUTTON_14) < 300) {
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(get_val(BUTTON_5) && rapidfire) { combo_run(RapidFire); }
}
combo RapidFire {
set_val(BUTTON_5, 100.0);
wait(59);
set_val(BUTTON_5, 0.0);
wait(37);
}
there is somthing wrong ...
can u make BUTTON_14 only work when i activate (.) in keyboard
( soo when i press (.) to trun in off the BUTTON_14 no more work >> when i press (.) to trun in on the BUTTON_14 work
-
TheOne - Sergeant First Class
- Posts: 21
- Joined: Mon Aug 13, 2018 7:43 pm
Re: i need help in script Rapidfire
So you want to en/disable the script with a key press and toggle rapid fire with a fast press of triangle ?
You may want to change one of the color-letter combination to indicate the script on/off and rapid fire on/off states differently.
You may want to change one of the color-letter combination to indicate the script on/off and rapid fire on/off states differently.
- Code: Select all
#pragma METAINFO("Script_Name", 1, 0, "<author_name>")
#include <display.gph>
#include <keyboard.gph>
#include "xkeys.gph"
uint8 KEYPERIOD;
bool rapidfire;
bool script;
init {
KEYPERIOD=xkeys_add(KEY_PADPERIOD);
}
main {
key_passthru();
if(xkeys_event_release(KEYPERIOD)) { // On release
script = !script;
if(script) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if (script) { // script enabled
if(event_release(BUTTON_14) && time_active(BUTTON_14) < 300) {
rapidfire = !rapidfire;
if(rapidfire) { // Enabled
led_reset();
led_set(LED_3, -1.0, 0);
display_overlay(_R_, 2000);
}
else { // Disabled
led_reset();
display_overlay(_X_, 2000);
}
}
if(get_val(BUTTON_5) && rapidfire) { combo_run(RapidFire); }
}
}
combo RapidFire {
set_val(BUTTON_5, 100.0);
wait(59);
set_val(BUTTON_5, 0.0);
wait(37);
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
17 posts
• Page 1 of 2 • 1, 2
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 116 guests