Hello, sorry for my bad english, i have a question about the Packet AddPlayer, i want to get the $pk->skin or $pk->skinID of a user that is online example: if($player->getName()->isOnline){ etc.. and if the user is offline i want to set the player skinID to Alex or Steve. Please H-HELP!
I don't really want the skin from any user i just want to spawn a player entity that is on scoreboard of my server, and i have all thing finish but the skin not.. i want to spawn a player entity whit the skin of the player on the TopPlayers understand? (sorry best english)
$nbt = Server::getInstance()->getOfflinePlayerData('puts nickname here'); $entityOfYourTopPlayersScoreboardOrWhatAreYouWanted->setSkin($nbt->Skin->Data, $nbt->Skin->Name); Do you mean this?
The new Skin API makes it easier. PHP: /** @var Player $topPlayer */ScoreboardEntity->setSkin($topPlayer->getSkin()); Don't forget to call ScoreboardEntity::sendSkin() o/ This API is only available in latest ALPHA9 development builds!
Can you give me an example what should i do on $pk->skin whit this PlayerListPacket? I want to get skin from other player that is on Ranking. I have see the packet and i don't now how to do that whit PHP: $pk->skin = new Skin( $this->getString(), //id $this->getString(), //data $this->getString(), //cape $this->getString(), //geometry name $this->getString() //geometry data );
Oh, but i won't to use $nbt i just use Packets like $pk, too for AddPlayerPacket. And have you an example whit nickname of others? I need to set?
I have this error whit CompoundTag Could not execute task leohardu\LeoHarduEntidade\Textos: Undefined property: pocketmine\nbt\tag\CompoundTag::$Skin Code PHP: $pk->skin = new Skin($nbt->Skin->Data, $nbt->Skin->Name);
I think PlayerSkinPacket is better for this, but i don't know how to get skin from other player and set to this packet.
If you're on API 3.0.0-ALPHA9 PHP: $packet = new PlayerSkinPacket();$packet->skin = $somePlayer->getSkin();
That would set $somePlayer to a boolean value, and as you probably already know, or should be knowing.. types in PHP don't have any callable functions like java does. They aren't even considered to be classes. getSkin() is a PocketMine API function and has nothing to do with PHP. Search PMMP for "getSkin" and find out what $somePlayer should be so as to call $somePlayer->getSkin()