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

Time not enable

Discussion in 'Development' started by JUZEXMOD, Aug 7, 2017.

?

what is wrong

  1. AA

    0 vote(s)
    0.0%
  2. AA

    0 vote(s)
    0.0%
  1. JUZEXMOD

    JUZEXMOD Spider

    Messages:
    8
    GitHub:
    DevolperPHP
    Hellow
    -------------
    my plugin is working but the time not work
    the sign teleport to lobby and enable time but time not work
     
  2. JUZEXMOD

    JUZEXMOD Spider

    Messages:
    8
    GitHub:
    DevolperPHP
    timer.php

    PHP:
    <?php

    namespace TheDropperDP;

    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\utils\Config;
    use 
    TheDropperDP\Main;

    class 
    Timer extends PluginTask{

        const 
    TIMER 200;

        public function 
    __construct(Main $plugin$player){

            
    parent::__construct($plugin);

            
    $this->plugin $plugin;

            
    $this->player $player;

            
    $this->timer Timer::TIMER;
        }

        public function 
    onRun($currentTick){

            
    $timea substr($this->timer1);

            
    $timeb substr($this->timer23);

            
    $this->getOwner();

            
    $this->player->sendMessage("§aTime : §b$timea , $timeb");

            if(
    $this->timer == 0){

                
    $this->player->sendMessage("§4 Time end");
            }
        }
    }
     
  3. XdmingXD

    XdmingXD Baby Zombie

    Messages:
    158
    GitHub:
    xdmingxd
    Why don't you do the easier way:facepalm:
    PHP:
    public function onRun($currentTick){
    /*
            $timea = substr($this->timer, 1); //???

            $timeb = substr($this->timer, 2, 3); /???

            $this->getOwner();  ///????????
    */

    //What are you doing with these line???

            
    if($this->timer == 0){

                
    $this->player->sendMessage("§4 Time end");
            }
         
    $this->player->sendMessage("§aTime : §b$this->timer , " Timer::TIMER); //Are you trying to do "$x Second , 200 second " ?
         
    $this->timer--;
    }
     
    Last edited: Aug 7, 2017
    jasonwynn10 likes this.
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    $this->timer is not changed anywhere at all.
    Regarding your display, if you want to display it in minutes and seconds, just do some simple arithmetic calculations:
    PHP:
    --$this->timer;
    $this->player->sendMessage("Time : " floor($this->timer 60) . " , " . ($this->timer 60));
     
    JUZEXMOD likes this.
  5. JUZEXMOD

    JUZEXMOD Spider

    Messages:
    8
    GitHub:
    DevolperPHP
    Thx <3
     
  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.