Guys how to send loading screen to player when they do /hub I am using this: (i know this dont work) PHP: elseif($cmd[0] === "/hub"){$player->getInventory()->clearAll();$player->getLevel()->addSound(new EndermanTeleportSound($player));$event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn());$this->getLevel()->getDimension();$this->setRank($player);$this->Items($player);$event->setCancelled(true); PLEASE HELP
Implement this into your code: PHP: $pk = new ChangeDimensionPacket();$pk->dimension = $player->getLevel()->getDimension();$pk->x = $player->getX();$pk->y = $player->getY();$pk->z = $player->getZ();$player->dataPacket($pk); And remove PHP: $this->getLevel()->getDimension(); It doesn't do anything.
is this god? PHP: elseif($cmd[0] === "/hub"){ $player->getInventory()->clearAll(); $player->getLevel()->addSound(new EndermanTeleportSound($player)); $event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn()); $pk = new ChangeDimensionPacket(); $pk->dimension = $this->getLevel()->getDimension(); $pk->x = $player->getX(); $pk->y = $player->getY(); $pk->z = $player->getZ(); $this->dataPacket($pk); $this->setRank($player); $this->Items($player); $event->setCancelled(true);
Please be aware that support for Genisys or other distributions will not be provided on these forums. You may discuss distributions on off-topic. Level->getDimension() does not currently exist in PocketMine-MP.
Now im using this PHP: elseif($cmd[0] === "/hub"){ $player->getInventory()->clearAll(); $event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn()); $this->setRank($player); $pk = new ChangeDimensionPacket(); $pk->dimension = $player->getLevel()->getDimension(); $pk->x = $player->getX(); $pk->y = $player->getY(); $pk->z = $player->getZ(); $player->dataPacket($pk); $this->Items($player); $event->setCancelled(); but when i do /hub it send loading screen but there is one problem.... Loading screen do not end. loading screen is sending xxx hours (sorry for my bad english) please help
You should have added [PHP ][/PHP ] around your code so people can read it properly. SOFe edited it for you.
oh sorry [PHP ] elseif($cmd[0] === "/hub"){ $player->getInventory()->clearAll(); $event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn()); $this->setRank($player); $pk = new ChangeDimensionPacket(); $pk->dimension = $player->getLevel()->getDimension(); $pk->x = $player->getX(); $pk->y = $player->getY(); $pk->z = $player->getZ(); $player->dataPacket($pk); $this->Items($player); $event->setCancelled(); [/PHP ] please help