Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Hide Player's NameTag to another Player

Comments in 'Plugin Development' started by Inta, May 15, 2016.

  1. Inta
    Offline

    Inta Active Member

    Joined:
    Feb 11, 2016
    Posts:
    84
    Minecraft User:
    InstantlyTa
    I mean just like in FPS games, you're able to see your Teammate's Nametag, but can't see Enemy's Nametag.
    Is there any way to do this in PocketMine ?
  2. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    I do not think so, the only way to hide a nametag, would be $player->setNameTag("");
    applqpak likes this.
  3. Inta
    Offline

    Inta Active Member

    Joined:
    Feb 11, 2016
    Posts:
    84
    Minecraft User:
    InstantlyTa
    That would be so sad ...
  4. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    No. Just no.
    PHP:
    $entity->setNameTagVisible($value)
    Or if you just want it for certain players, create a SetEntityDataPacket with the player's entity ID and name visibility flag set to false (0),
    PHP:
    $pk = new SetEntityDataPacket();
    $pk->eid $playerWhoseNameWeWantToHide->getId();
    $pk->metadata = [Entity::DATA_SHOW_NAMETAG => 0];
    $player->dataPacket($pk);
    And please don't just copy and paste the code or it won't work.
    PocketKiller, Primus, KubixQ and 3 others like this.
  5. Inta
    Offline

    Inta Active Member

    Joined:
    Feb 11, 2016
    Posts:
    84
    Minecraft User:
    InstantlyTa
    Shiet you're my god.. Gonna try right now!
  6. Inta
    Offline

    Inta Active Member

    Joined:
    Feb 11, 2016
    Posts:
    84
    Minecraft User:
    InstantlyTa
    Oh my... Thank you! It works!
  7. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    That's another way of doing it, but please don't just reply "no, just no." It's very disrespectful.
    Inta likes this.
  8. Inta
    Offline

    Inta Active Member

    Joined:
    Feb 11, 2016
    Posts:
    84
    Minecraft User:
    InstantlyTa
    Sorry I didn't notice that. I'm very bad at Grammar..
  9. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    But your "method" doesnt hide the nametag you see the nametag but no letters or something else only a space...
  10. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Actually, setNameTag(""); will basically remove the tag entirely.
    Last edited: May 16, 2016
    Primus likes this.
  11. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Yeah

Share This Page

Advertisement