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

Delay on command

Discussion in 'Development' started by PixelzChris, Jun 27, 2018.

  1. PixelzChris

    PixelzChris Silverfish

    Messages:
    17
    Can someone show me a full part of code on how to add delay in a command (sub command)
    I just want to adda cool down like this 5-4-3-2-1 and after this the command
     
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    When typed command make it delayed than execute task make it timer and done
     
  3. abdullah

    abdullah Spider

    Messages:
    14
    GitHub:
    x3boodx
    I think you can use usleep function you can do :
    PHP:
    $sender->sendTip("5");
    usleep(1000000); //time in microseconds
    $sender->sendTip("4");
    you should know every 1000000 microseconds = 1 second
    and you can read more about it in this site
     
  4. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    usleep sounds like the sleep() that makes your server sleep
     
    HimbeersaftLP likes this.
  5. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    That will block your server's main thread until the time is passed, never ever use this in your plugin unless you exactly know what you're trying to accomplish with it.
     
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    xXNiceAssassinlo YT 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.