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

set Player nametag

Discussion in 'Development' started by Kyd, Mar 18, 2017.

  1. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    I added Player using AddPlayer packet and tried to set nametag, but dont working
    PHP:
    public function createNPC(Player $p){
    $pk = new AddPlayerPacket();
    $title "Playing $this->song";
    $pk->uuid UUID::FromRandom();
        
    $pk->eid 9273;
        
    $pk->128;
        
    $pk->65;
        
    $pk->134;
        
    $pk->speedY 0;
        
    $pk->speedX 0;
        
    $pk->speedZ 0;
        
    $pk->yaw 0;
        
    $pk->item Item::get(0);
        
    $pk->headYaw 0;
        
    $pk->pitch 0;
        
    $pk->metadata = [Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING$title]];
        
    $p->dataPacket($pk);
    }
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    'But dont working'
    What is not working? What do you expect it to do, and what does(n't) it do? Does it give any errors?
     
  3. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Setting name tag not working.. Not i dont get any errors
     
  4. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    How to define $entity
     
  5. Primus

    Primus Zombie Pigman

    Messages:
    749
    Player is Entity (FYI)
    Code:
    $entity = null;
    $entity = "";
    $entity = PHP_INT_MAX;
    $entity = [];
    $entity = M_PI;
    $entity = true;
    $entity = [Foo::class, "bar"];
    $entity = new Bar();
    
    Please learn the language before attempting.
     
    Muqsit and Sandertv like this.
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Entity::setNameTag(string);
     
  7. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    I want to set nametag in addPlayerPacket
     
  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.