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.

Solved Cooldown

Discussion in 'Skript' started by CringeBoy, Jun 4, 2021.

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

    CringeBoy Active Member

    Joined:
    May 20, 2021
    Messages:
    65
    Likes Received:
    0
    Code (Text):
    1. on right click:
    2.     if player is holding a quartz named "&fBandage":
    3.         play sound "meds.bandage" with volume 1 to player
    4.         wait 90 ticks
    5.         add 0.5 to player's health
    6.         remove 1 quartz named "&fBandage" from the player
    Can someone help me to add cooldown between right clicks? I need it so u can use it after like 20 ticks the first bandage ends
     
  2. wCrazy_

    wCrazy_ Member

    Joined:
    Jan 7, 2021
    Messages:
    15
    Likes Received:
    0
    Try this :emoji_slight_smile:
    Code (Text):
    1. on right click:
    2.     if player is holding a quartz named "&fBandage":
    3.         if {_bandage.cooldown.%player%} is false:
    4.             play sound "meds.bandage" with volume 1 to player
    5.             set {_bandage.cooldown.%player%} to true
    6.             wait 90 ticks
    7.             add 0.5 to player's health
    8.             remove 1 quartz named "&fBandage" from the player
    9.             set {_bandage.cooldown.%player%} to false
    10.  
    11. on join:
    12.     set {_bandage.cooldown.%player%} to false
     
  3. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    Won't work - you can't use a local variable everywhere in your script
    This would work:
    Code (Text):
    1. on right click:
    2.     if player is holding a quartz named "&fBandage":
    3.       if difference between now and {lastbandage::%player%} is more than 20 ticks:
    4.           play sound "meds.bandage" with volume 1 to player
    5.           wait 90 ticks
    6.           add 0.5 to player's health
    7.           remove 1 quartz named "&fBandage" from the player
    8.           set {lastbandage::%player%} to now
     
  4. CringeBoy

    CringeBoy Active Member

    Joined:
    May 20, 2021
    Messages:
    65
    Likes Received:
    0
    I already fixed the code, I marked the thread solved but he still posted his thing
     
Thread Status:
Not open for further replies.

Share This Page

Loading...