Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved restart countdown?

Comments in 'Plugin Development' started by PaulchenHD, Mar 31, 2016.

  1. PaulchenHD
    Offline

    PaulchenHD Active Member

    Joined:
    Jan 17, 2016
    Posts:
    111
    Minecraft User:
    Paulchen_HD
    i like if the countdown 0 :
    PHP:
    if($seconds == 0) {
      foreach(
    $this->getOwner()->getServer()->getOnlinePlayers() as $player) {
      
    $player->sendMessage(Color::RED."TEST");
      }
    i like to restart the countdown and the countdown goes infinity


    thx for help :)
    Last edited: Apr 1, 2016
  2. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    OnRun function, if the countdown get 0, do that.
    What's the problem?
    applqpak likes this.
  3. PaulchenHD
    Offline

    PaulchenHD Active Member

    Joined:
    Jan 17, 2016
    Posts:
    111
    Minecraft User:
    Paulchen_HD
    i like to restart the countdown ...
  4. PaulchenHD
    Offline

    PaulchenHD Active Member

    Joined:
    Jan 17, 2016
    Posts:
    111
    Minecraft User:
    Paulchen_HD
    if the countdown is 0
  5. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I think that you're looking for the code...
    PHP:
    class Countdown extends PluginTask{

    protected 
    $timer 666;

    public function 
    __construct(Plugin $plugin){
    parent::__construct($plugin);
    }

    public function 
    OnRun($tick){
    --
    $this->timer;
    if(
    $this->timer === 0){
    $this->timer 666#set it to the original value
    }
    }
    }
    And why you use two post to tell me one thing that I already knowed? This is not a problem for me, really, I told you that because if you don't change that way, a lot of "developers" will start to flame you (that's the only way for they to get likes).
    Last edited: Mar 31, 2016
    applqpak and PaulchenHD like this.
  6. PaulchenHD
    Offline

    PaulchenHD Active Member

    Joined:
    Jan 17, 2016
    Posts:
    111
    Minecraft User:
    Paulchen_HD
    thanks i try it later :)
  7. PaulchenHD
    Offline

    PaulchenHD Active Member

    Joined:
    Jan 17, 2016
    Posts:
    111
    Minecraft User:
    Paulchen_HD
    thx it works :) ..
  8. TheKillerTacos
    Offline

    TheKillerTacos Active Member

    Joined:
    Jan 21, 2016
    Posts:
    76
    Minecraft User:
    TheKillerTacos
    Always check your Spelling erros in PHP, or bad things may happen, and if you got your answer, please Get this thread as Solved,

    $player->sendMessage(Color::RED."TEST");
    applqpak likes this.

Share This Page

Advertisement