1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Faster Right click?

Discussion in 'Skript' started by zack5, Dec 29, 2017.

Thread Status:
Not open for further replies.
  1. zack5

    zack5 Member

    Joined:
    Dec 13, 2017
    Messages:
    3
    Likes Received:
    0
    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?
     
  2. Selvati

    Selvati Active Member

    Joined:
    Jun 26, 2017
    Messages:
    190
    Likes Received:
    9
    ?
    Code (Skript):
    1. on rightclick:
    2.     set {r-click.%player%} to true
    3.     wait 1 tick
    4.     set {r-click.%player%} to false
    5.  
    6. every 5 ticks:
    7.     loop all players:
    8.         if {r-click.%loop-player%} is true:
    9.             #do stuff
    Notice:This is likely to cause lagg.
     
  3. White

    White Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    445
    Likes Received:
    25
    Well? It depends on how you structured the gun code.
     
  4. zack5

    zack5 Member

    Joined:
    Dec 13, 2017
    Messages:
    3
    Likes Received:
    0
    Code (Skript):
    1. on rightclick holding stick:
    2.     broadcast "%difference between {difference} and now%"
    3.     make player shoot a snowball at speed 10
    4.     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?
     
  5. ChisleLP

    ChisleLP Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    789
    Likes Received:
    58
    im not sure if this works

    Code (Skript):
    1. on right click:
    2.     if {Trigger::%player%} is set:
    3.         delete {Trigger::%player%}
    4.         stop
    5.     set {Trigger::%player%} to true
    6.     while {Trigger::%player%} is set:
    7.         make player shoot a snowball at speed 10
    8.         wait a ticks
     
  6. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    if they rightclick once wouldnt it it never stop shooting?
     
  7. ChisleLP

    ChisleLP Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    789
    Likes Received:
    58
    Of course, he need right clicked again. :emoji_wink:
     
  8. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    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
     
  9. ChisleLP

    ChisleLP Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    789
    Likes Received:
    58
    i added a check if is set, the it stopped the evetns? what the problem?
     
  10. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    oh yeah didnt see the stop line my bad
     
    • Funny Funny x 1
  11. ChisleLP

    ChisleLP Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    789
    Likes Received:
    58
    Np, can happens. :emoji_grinning:

    i wish you great new years (For me its in 30 minutes.)
     
Thread Status:
Not open for further replies.

Share This Page

Loading...