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

Solved How to add a skin to a Player packet

Discussion in 'Development' started by mal0ne_23, Jun 25, 2017.

  1. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23
    Okay. I've tried the playerlistpacket, but it only appears on SOME of my players.

    http://imgur.com/a/5ssV2

    As you can see in this picture, bots 2 and 3 have custom skins, but the rest are all my skin. How can I fix that?
     
  2. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    Can you show us the code you are using ?
    Normally, you have to set the skin of the player packet in the uuid field.

    EDITED : Sorry, It's false.
     
  3. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23
    PHP:
            $pk = new PlayerListPacket();
            
    $pk->type PlayerListPacket::TYPE_ADD;
            
    $pk->entries[] = [$uuid$this->getId(), "Mascot""Standard_Custom", (file("/home/data/skins/techie_mascot.dat")[0])];
            
    $player->dataPacket($pk);
     
  4. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23
    I fixed it. don't use file() when getting skin contents, use file_get_contents xd
     
  5. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    Why not store the skin in the plugin resources directory? It's much safer.
     
  6. mal0ne_23

    mal0ne_23 Spider Jockey

    Messages:
    30
    GitHub:
    mal0ne-23
    Because I use these files on all of my servers. It's easier to manage.
     
  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.