Solved Cooldown

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

CringeBoy

Active Member
May 20, 2021
65
0
6
Romania
Code:
on right click:
    if player is holding a quartz named "&fBandage":
        play sound "meds.bandage" with volume 1 to player
        wait 90 ticks
        add 0.5 to player's health
        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
 
Try this :emoji_slight_smile:
Code:
on right click:
    if player is holding a quartz named "&fBandage":
        if {_bandage.cooldown.%player%} is false:
            play sound "meds.bandage" with volume 1 to player
            set {_bandage.cooldown.%player%} to true
            wait 90 ticks
            add 0.5 to player's health
            remove 1 quartz named "&fBandage" from the player
            set {_bandage.cooldown.%player%} to false

on join:
    set {_bandage.cooldown.%player%} to false
 
Try this :emoji_slight_smile:
Code:
on right click:
    if player is holding a quartz named "&fBandage":
        if {_bandage.cooldown.%player%} is false:
            play sound "meds.bandage" with volume 1 to player
            set {_bandage.cooldown.%player%} to true
            wait 90 ticks
            add 0.5 to player's health
            remove 1 quartz named "&fBandage" from the player
            set {_bandage.cooldown.%player%} to false

on join:
    set {_bandage.cooldown.%player%} to false

Won't work - you can't use a local variable everywhere in your script
This would work:
Code:
on right click:
    if player is holding a quartz named "&fBandage":
      if difference between now and {lastbandage::%player%} is more than 20 ticks:
          play sound "meds.bandage" with volume 1 to player
          wait 90 ticks
          add 0.5 to player's health
          remove 1 quartz named "&fBandage" from the player
          set {lastbandage::%player%} to now
 
Status
Not open for further replies.