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

Timer is not Working

Discussion in 'Development' started by Hoyee, Jun 6, 2020.

  1. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    I'm making a timer but it doesn't work. Why??

    This is the error part "Undefined property: ring\rang::$Clock" (EXCEPTION)
    PHP:
    public function Clock(){

            
    $this->getServer()->broadcastTip("{$this->Clock}Second Left");

            
    $this->Clock--;

          }
    and here is using task part of that
    PHP:
    class Count extends Task{

      public function 
    __construct(rang $rang){

        
    $this->rang $rang;

        
    $this->Clock 300;

      }

      public function 
    onRun(int $currentTick){

        
    $this->rang->Clock();

      }
    }
     
  2. Emirhan Akpınar

    Emirhan Akpınar Slime

    Messages:
    90
    You must add
    PHP:
    public $rang;

    public 
    $Clock;
    to correct classes.
     
  3. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    I did what you said but now it says error of what you said..
    Where should I put that? and Why should I use that?
     
  4. Emirhan Akpınar

    Emirhan Akpınar Slime

    Messages:
    90
    These are properties. You must add $rang, $Clock property to Clock.php and $Clock property to rang.php.
     
  5. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    I don't have a Clock.php
     
  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.