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

php update

Discussion in 'Development' started by Doxestic, Jan 3, 2021.

  1. Doxestic

    Doxestic Spider Jockey

    Messages:
    41
    hi there
    i have a entity (car) that have a pass property

    but when i want to check if a property is null or player it only return one thing and never change it

    i have this code for seat pas:
    PHP:
    public function seat_pass (Player $player){
    if (
    $this->pass1 == null // it say there is no passenger here
    $this->pass1 $player;
    }
    }
    and get it:
    PHP:
    public function canAddPass (){
     if (
    $this->pass1 == null){
    return 
    true;
    }
    return 
    false;
    }
    but it always return true and passenger add on there head :/
    and i use
    PHP:
    public function onHit (){
    //some code

    if ($entity->canAddPass () === true){
    //seat player
    }
    }
    my entity extends to carBase that i made it and carBase extends Human entity
     
  2. RicardoMilos384

    RicardoMilos384 Slime

    Messages:
    82
    GitHub:
    ricardomilos384
    PHP:
    protected $pass1;
     
  3. Doxestic

    Doxestic Spider Jockey

    Messages:
    41
    but some of my cars will have 2 or 3 passengers what should i do for it?
     
  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.