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.

command timer

Discussion in 'Skript' started by TripleThreat02, Apr 21, 2021.

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

    Joined:
    Apr 21, 2021
    Messages:
    4
    Likes Received:
    0
    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
     
  2. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    427
    Likes Received:
    30
    You can use the "cooldown storage" option in commands.
    Code (Text):
    1. command /youtube <text>:
    2.   aliases: /yt
    3.   permission: youtube.broadcast
    4.   permission message: You Must Have YouTube Rank To Use This.
    5.   cooldown: 5 minutes
    6.   cooldown storage: {seconds}
    7.   cooldown message: You Need To Wait %{seconds}% seconds To Do This Again.
    8.   cooldown bypass: youtube.cooldown.bypass
    9.   trigger:
    10.     # do stuff here
     
  3. TripleThreat02

    Joined:
    Apr 21, 2021
    Messages:
    4
    Likes Received:
    0


    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
     
  4. Shadow501pl

    Shadow501pl Active Member

    Joined:
    Dec 19, 2020
    Messages:
    62
    Likes Received:
    2
    If it doesnt work you can do:
    Code (Text):
    1. command /youtube:
    2.   trigger:
    3.     set {_diffrence} to diffrence between {%player%.ytcooldown} and now
    4.     if {_diffrence} is more than 10 seconds:
    5.       set {%player%.ytcooldown} to now
    6.       message "&cYoutube"
    7.      else:
    8.        if {%player%.ytcooldown} is not set:
    9.          set {%player%.ytcooldown} to now
    10.        else:
    11.          message "&cThis command is on cooldown!"
     
  5. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    427
    Likes Received:
    30
    "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?
     
  6. TripleThreat02

    Joined:
    Apr 21, 2021
    Messages:
    4
    Likes Received:
    0
    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?
    --- Double Post Merged, Apr 23, 2021, Original Post Date: Apr 23, 2021 ---
    It basically printed out the date and time into a message to the player
     
  7. Shadow501pl

    Shadow501pl Active Member

    Joined:
    Dec 19, 2020
    Messages:
    62
    Likes Received:
    2
    ok so i might have spelled diffrence wrong idk but it should work instead of printing the date so "message "&cCooldown: &4%{_diffrence}%"
     
  8. TripleThreat02

    Joined:
    Apr 21, 2021
    Messages:
    4
    Likes Received:
    0
    --- Double Post Merged, Apr 23, 2021, Original Post Date: Apr 23, 2021 ---
    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
     
  9. Shadow501pl

    Shadow501pl Active Member

    Joined:
    Dec 19, 2020
    Messages:
    62
    Likes Received:
    2
    Code (Text):
    1. set {_calc} to 300 seconds - {_diffrence}
    Use that before the message
     
Thread Status:
Not open for further replies.

Share This Page

Loading...