1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How top create a command cooldown

Discussion in 'Development' started by DerCooleVonDem, Jul 4, 2020.

?

How top create a command cooldown

  1. I can

    1 vote(s)
    50.0%
  2. I cant

    2 vote(s)
    100.0%
Multiple votes are allowed.
  1. DerCooleVonDem

    DerCooleVonDem Spider Jockey

    Messages:
    37
    GitHub:
    Soon
    I want to create a command cooldown


    But how?
     
  2. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    113
    GitHub:
    jviguy
    Theres a thing called tasks which run every tick u can customize them to many things like repeat a message for a specified amount of time or what ever to make a delay simply make a task which when a player runs the said command it starts a task. then if a player says that command while the task is running in chat it will cancel the event look up more about tasks on the forums or pmmp in general before attempting making a task.
     
  3. Fadhel

    Fadhel Witch

    Messages:
    68
    GitHub:
    dimbis
    or simply store the date when they run the command and everytime they run it compare the stored date with the current date.
     
  4. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    113
    GitHub:
    jviguy
    thats much easier lol i'm use that for now on lol
     
  5. UnEnanoMas

    UnEnanoMas Spider Jockey

    Messages:
    36
    GitHub:
    UnEnanoMas
  6. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    How is making a repeating task per command player that will lag the entire the server easier than checking if an interval is higher than the desired amount of time?

    PHP:
    $storedTime time();

    if(
    time() - $storedTime >= 60) {
        echo 
    "5 minutes have passed.";
    } else {
        echo 
    "5 minutes have NOT passed yet.";
    }
     
    Last edited: Jul 10, 2020
    Primus likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.