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.

tnt cooldown help

Discussion in 'Skript' started by blorbee, Aug 7, 2020.

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

    blorbee Member

    Joined:
    Aug 5, 2020
    Messages:
    2
    Likes Received:
    0
    i been looking all over the place for an answer and only found one that DOESNT WORK WITH MY SKRIPT!
    pelase help

    Code (Text):
    1.  
    2. on rightclick holding dispenser:
    3.     if {_Waiting} is true:
    4.         cancel event
    5.         send "&6You're on Cooldown, Please wait!"
    6.         wait 5 seconds
    7.         set {_Waiting} to false
    8.         stop
    9.     if {_Waiting} is false:
    10.        player has 1 tnt
    11.        spawn a primed tnt 1 meter above the player
    12.        push the spawned entity in direction of player at speed 0.9
    13.        push the spawned entity upwards at speed 0.2
    14.        remove 1 tnt from player
    15.        set {_Waiting} to true
    16. on place dispenser:
    17.     cancel event
    18.  
     
  2. IDuckz_

    IDuckz_ Active Member

    Joined:
    Jul 25, 2019
    Messages:
    106
    Likes Received:
    2
    You are using a local variable which gets deleted after the code ends, so the {_Waiting} variable is not set to true nor false so it will not do anything. Instead try changing it to "{-waiting::%player%}" and make sure that the {-waiting::%player%} variable is set to true or false.
     
  3. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    Code (Text):
    1. on rightclick holding dispenser:
    2.     if difference between {Waiting::%player%} and now is not more than 5 seconds:
    3.         cancel event
    4.         send "&6You're on Cooldown, Please wait!"
    5.         stop
    6.     else:
    7.        player has 1 tnt
    8.        spawn a primed tnt 1 meter above the player
    9.        push the spawned entity in direction of player at speed 0.9
    10.        push the spawned entity upwards at speed 0.2
    11.        remove 1 tnt from player
    12.        set {Waiting::%player%} to now
    13. on place dispenser:
    14.     cancel event
    --- Double Post Merged, Sep 7, 2020, Original Post Date: Sep 7, 2020 ---
    If the first one doesn't work try this one
    Code (Text):
    1. on rightclick holding dispenser:
    2.     if {Waiting::%player%} is not set:
    3.        player has 1 tnt
    4.        spawn a primed tnt 1 meter above the player
    5.        push the spawned entity in direction of player at speed 0.9
    6.        push the spawned entity upwards at speed 0.2
    7.        remove 1 tnt from player
    8.        set {Waiting::%player%} to now
    9.     else:
    10.         if difference between {Waiting::%player%} and now is not more than 5 seconds:
    11.             cancel event
    12.             send "&6You're on Cooldown, Please wait!"
    13.             stop
    14.         else:
    15.             player has 1 tnt
    16.             spawn a primed tnt 1 meter above the player
    17.             push the spawned entity in direction of player at speed 0.9
    18.             push the spawned entity upwards at speed 0.2
    19.             remove 1 tnt from player
    20.             set {Waiting::%player%} to now
    21. on place dispenser:
    22.     cancel event
    23. on quit:#this is so as not to overload the server with varariables
    24.     delete {Waiting::%player%}
    25. on unload:#this is so as not to overload the server with varariables
    26.     delete {Waiting::*}
     
Thread Status:
Not open for further replies.

Share This Page

Loading...