Need help with cooldown command

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

Geico

New Member
Jan 19, 2021
6
0
1
23
Can someone help me with this, i made a fire wand skript where a bamboo stick shoots a fire ball, i want it so that if you used it once,theres a cooldown for 5 seconds.
 
You could either use:
Code:
your event:
  if player's held item is ...: #the bamboo stick and it's name
    set {_waited} to difference between {bamboostick::%player's uuid%::lastuse} and now
    if {_waited} is less than 5 seconds:
      send "no"
    else:
      #your code (the thing that makes the bamboo stick shoot the fireball)
      set {bamboostick::%player's uuid%::lastuse} to now

The {bamboostick::%player's uuid%::lastuse} variable is just an example, this can be any variable, as long as it's linked to the player so the cooldown is only for that specific player.

Or you could use:
Code:
your event:
  if player's held item is ...: #the bamboo stick and it's name
    if unix date of (metadata tag "cooldown" of player) was less than 3 seconds ago:
      send "no"
    else:
      #your code (the thing that makes the bamboo stick shoot the fireball)
      set metadata "cooldown" of player to unix timestamp of now

I hope I didn't make any mistakes while typing this, hope it helped.
 
Can someone help me with this, i made a fire wand skript where a bamboo stick shoots a fire ball, i want it so that if you used it once,theres a cooldown for 5 seconds.
I use that:
it's a little different than tistay's method but yeah...

Code:
command /toll:
  trigger:
    if player doesn't have permission "toll.fireroz.is.extra.cool.bypass":
      set {b} to difference between {b.%player%} and now
      if {b} is less than 5 seconds:
        send "&cbc ur a noob u need to wait longer before doing my cool comman d vecause i am 12 and i iwll not allowc PSAMMERS. &7(%difference between {b} and 5 seconds%"
        stop
      set {b.%player%} to now
    send "&ayay you did it ok bye i hate u ok no jk ily but like im noooo byeee"
me also add bypass permission



ohhh im a child
 
Status
Not open for further replies.