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 our 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.

Solved While right click

Discussion in 'Skript' started by Jay_2004, Dec 18, 2018.

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

    Jay_2004 Member

    Joined:
    Feb 21, 2017
    Messages:
    13
    Likes Received:
    1
    Is there a way to make it so that when you right click, it triggers a "while" event that keeps going while you are right clicking.

    Code (Text):
    1.  
    2. on right click with 2256:
    3.     if {alreadyfiring.%player%} is not set:
    4.         if player is right clicking:
    5.             set {alreadyfiring.%player%} to "True"
    6.             while player is right clicking:
    7.                 wait 2 ticks
    8.                 make player shoot snowball at speed 3
    9.                 play raw sound "tile.piston.in" at location of player with pitch 2 volume 1
    10.             delete {alreadyfiring.%player%}
    11.         else:
    12.             stop
    Obviously, the "if player is right clicking" and "while player is right clicking" don't work, thats what I need help with.
    If anyone could help or have another idea I could do this a reply would be great :emoji_slight_smile:

     
  2. Best Answer:
    Post #5 by TX Plugins, Dec 19, 2018
  3. Yodaylay22

    Yodaylay22 Member

    Joined:
    Jul 24, 2018
    Messages:
    15
    Likes Received:
    1
    loop 10 times: ??? I could not understand exactly what your problem is.
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,122
    Likes Received:
    157
    Im confused here too.
    On right click... while right clicking? What is the point of that.
    Your effect while fire each time a player right clicks.... no need to use a condition to check for right clicking and use a while loop.
     
  5. Jay_2004

    Jay_2004 Member

    Joined:
    Feb 21, 2017
    Messages:
    13
    Likes Received:
    1
    doesn't work. Its way too slow to meet the ROF of an AK...
    on right click with (gun):
    while player is holding right click:
    wait 1 tick
    make player shoot snowball at speed 3
     
  6. TX Plugins

    TX Plugins Member

    Joined:
    Nov 18, 2018
    Messages:
    4
    Likes Received:
    2
    Code (Skript):
    1. On right click:
    2.  If {holdclick::%uuid of player%} is not set:
    3.   Set {holdclick::%uuid of player%} to 0
    4.   While {holdclick::%uuid of  player%} < 5:
    5.    make player shoot snowball at speed 3
    6.    Wait 1 tick
    7.    Add 1 to {holdclick::%uuid of player%}
    8.    If {holdclick::%uuid of player%} is not set:
    9.     Stop
    10.   Delete {holdclick::%uuid of player%}
    11.  Else:
    12.   Set {holdclick::%uuid of player%} to 0
    13.  
    14. On script load:
    15.  Delete {holdclick::*}
    --- Double Post Merged, Dec 19, 2018, Original Post Date: Dec 19, 2018 ---
    I have found another way to do this without using variables. Hope this helps!

    Code (Skript):
    1. on right click:
    2.     loop 4 times:
    3.         shoot snowball at speed 3
    4.         wait 1 tick
     
    • Like Like x 1
  7. Jay_2004

    Jay_2004 Member

    Joined:
    Feb 21, 2017
    Messages:
    13
    Likes Received:
    1
    Thanks! :emoji_slight_smile:

    Finished Product:
     
    #6 Jay_2004, Dec 20, 2018
    Last edited: Dec 20, 2018
    • Like Like x 1
Thread Status:
Not open for further replies.
Loading...