command timer

  • 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.
Apr 21, 2021
4
0
1
21
I am trying to create a cooldown timer so that when someone runs the command it will say a message saying you have to wait x amount of settings, but when i did it first time, it went below 0, the second time, it won't go down, i'm out of ideas, anyway enough ranting, here's the code: https://pastebin.com/TR6E8CPT
 
You can use the "cooldown storage" option in commands.
Code:
command /youtube <text>:
  aliases: /yt
  permission: youtube.broadcast
  permission message: You Must Have YouTube Rank To Use This.
  cooldown: 5 minutes
  cooldown storage: {seconds}
  cooldown message: You Need To Wait %{seconds}% seconds To Do This Again.
  cooldown bypass: youtube.cooldown.bypass
  trigger:
    # do stuff here
 
You can use the "cooldown storage" option in commands.
Code:
command /youtube <text>:
  aliases: /yt
  permission: youtube.broadcast
  permission message: You Must Have YouTube Rank To Use This.
  cooldown: 5 minutes
  cooldown storage: {seconds}
  cooldown message: You Need To Wait %{seconds}% seconds To Do This Again.
  cooldown bypass: youtube.cooldown.bypass
  trigger:
    # do stuff here



Ok, i tried it, it didn't work at first, so i used this instead:

variables:
{seconds} = "300"
command /youtube <text>:
aliases: /yt
permission: youtube.broadcast
permission message: You Must Have YouTube Rank To Use This.
cooldown: {seconds} Seconds
cooldown storage: {seconds}
cooldown message: You Need To Wait %{seconds}% seconds To Do This Again.
cooldown bypass: youtube.cooldown.bypass
trigger:
broadcast "&f&l[YOU&c&lTUBE&f&l] &4&l%arg-1%"





but this now just send the date and time of when the last reload was
 
If it doesnt work you can do:
Code:
command /youtube:
  trigger:
    set {_diffrence} to diffrence between {%player%.ytcooldown} and now
    if {_diffrence} is more than 10 seconds:
      set {%player%.ytcooldown} to now
      message "&cYoutube"
     else:
       if {%player%.ytcooldown} is not set:
         set {%player%.ytcooldown} to now
       else:
         message "&cThis command is on cooldown!"
 
Ok, i tried it, it didn't work at first, so i used this instead:

variables:
{seconds} = "300"
command /youtube <text>:
aliases: /yt
permission: youtube.broadcast
permission message: You Must Have YouTube Rank To Use This.
cooldown: {seconds} Seconds
cooldown storage: {seconds}
cooldown message: You Need To Wait %{seconds}% seconds To Do This Again.
cooldown bypass: youtube.cooldown.bypass
trigger:
broadcast "&f&l[YOU&c&lTUBE&f&l] &4&l%arg-1%"





but this now just send the date and time of when the last reload was
"it didn't work at first", what didn't work? Can you give me an error if any, or can you give me a screenshot/video of what happened?
 
I get this error: Can't understand this expression: ('diffrence between {%player%.ytcooldown}' and now) (youtube.sk, line 5: set {_diffrence} to diffrence between {%player%.ytcooldown} and now')

Also where would i put the broadcast part and the permission messages?
[doublepost=1619183937,1619183867][/doublepost]
"it didn't work at first", what didn't work? Can you give me an error if any, or can you give me a screenshot/video of what happened?
It basically printed out the date and time into a message to the player
 
ok so i might have spelled diffrence wrong idk but it should work instead of printing the date so "message "&cCooldown: &4%{_diffrence}%"
 
[doublepost=1619185296,1619184742][/doublepost]
ok so i might have spelled diffrence wrong idk but it should work instead of printing the date so "message "&cCooldown: &4%{_diffrence}%"
Ok i tried editing it a little and sort of got it to do what i want with this code:

command /youtube <text>:
aliases: /yt
permission: youtube.broadcast
permission message: You Must Have YouTube Rank To Use This.
trigger:
set {_difference} to difference between {%player%.ytcooldown} and now
if {_difference} is more than 300 seconds:
set {%player%.ytcooldown} to now
broadcast "&f&l[YOU&c&lTUBE&f&l] &4&l%arg-1%"
else:
if {%player%.ytcooldown} is not set:
set {%player%.ytcooldown} to now
else:
message "&cYou Have To Wait Another &c&l%{_difference}% Seconds"


How would i make it count down
 
Status
Not open for further replies.