Faster Right click?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

zack5

Member
Dec 13, 2017
3
0
0
24
Hi, I'm making guns for a server I have, and for automatic rifles they shoot too slowly when I use an on right click event. Are there any alternatives or fixes for this?
 
?
code_language.skript:
on rightclick:
    set {r-click.%player%} to true
    wait 1 tick
    set {r-click.%player%} to false

every 5 ticks:
    loop all players:
        if {r-click.%loop-player%} is true:
            #do stuff
Notice:This is likely to cause lagg.
 
Well? It depends on how you structured the gun code.
code_language.skript:
on rightclick holding stick:
    broadcast "%difference between {difference} and now%"
    make player shoot a snowball at speed 10
    set {difference} to now
(that was a test.)
it fires it every 0.2 seconds, or 4 ticks, if I just simply hold down right click. is there a way to make this faster?
 
im not sure if this works

code_language.skript:
on right click:
    if {Trigger::%player%} is set:
        delete {Trigger::%player%}
        stop
    set {Trigger::%player%} to true
    while {Trigger::%player%} is set:
        make player shoot a snowball at speed 10
        wait a ticks
 
im not sure if this works

code_language.skript:
on right click:
    if {Trigger::%player%} is set:
        delete {Trigger::%player%}
        stop
    set {Trigger::%player%} to true
    while {Trigger::%player%} is set:
        make player shoot a snowball at speed 10
        wait a ticks
if they rightclick once wouldnt it it never stop shooting?
 
Of course, he need right clicked again. :emoji_wink:
no matter how many times you click it always ends on "set {Trigger::%player%} to true" so its always going to shoot. i was saying once you click it will never stop even if you click again
 
no matter how many times you click it always ends on "set {Trigger::%player%} to true" so its always going to shoot. i was saying once you click it will never stop even if you click again
i added a check if is set, the it stopped the evetns? what the problem?
 
Status
Not open for further replies.