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

HOW CAN I MAKE LIVE TIMER IN HUD?

Discussion in 'Development' started by Levi, Jan 13, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    I Did This using task but People said ths method is no good
    is there esier method than this?
    PHP:
    public function onRun($tick){
     
           
            switch(
    $this->seconds) {
    $this seconds is equl 8
                 
                
    case 8:
    $player->sendTip("Timer: 8");
     
    $player is the player
                    
    break;
                case 
    7:
    $player->sendTip("Timer: 7");
                   
                    break;
                case 
    6
    $player
    ->sendTip("Timer: 6");
                   
                    break;
     
                case 
    5:
    $player->sendTip("Timer: 5");
                   
                    break;
                   
                case 
    4:
    $player->sendTip("Timer: 4");
                    break;
                   
                case 
    3:
    $player->sendTip("Timer: 3");
                   
                    break;
                case 
    2:
    $player->sendTip("Timer: 2");

                   
                    break;
                    case 
    1:
     
    $player->sendTip("Timer: 1");
                   
               
                    break;
                   
                case 
    0:
    $player->sendTip("Timer: 0");
                    break;
            }
            
    $this->seconds--;
           
        }
     
  2. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    That's a lot of unnecessary code.

    PHP:
    public function onRun($currentTick) {
        
    /**@var object*/
        
    $player->sendTip("Timer {$this->seconds}");
        
    $this->seconds--;
    }
    Be sure to define $player, my example provides what you needed. It isn't complete.
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
  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.