Code: Fatal Error: Call to member function getSafeSpawn() on null in.....on line 86. I cant teleport a player to a world? Does anyone know why? PHP: if($sign instanceof \pocketmine\tile\Sign) { if ($this->schildRegistrieren === false) { $text = $sign->getText(); $level = $this->getServer()->getLevelByName($text[1]); if ($text[0] === $this->prefix) { $inDerWelt = 0; if($inDerWelt < 16 && !($text[3] === "§cVoll")) { $teleportSound = new EndermanTeleportSound($player); $player->getLevel()->addSound($teleportSound); $levelName = $level->getName(); $this->getServer()->loadLevel($levelName); $player->teleport($level->getSafeSpawn()); $player->getInventory()->clearAll(); $inDerWelt++; Thanks!
Just found out. did the second line of the sign contain the RIGHT worldname? because that means it does not exist
PHP: $level = $this->getServer()->getLevelByName($this->levelName); $inDerWelt = count($level->getPlayers()); $fullOrNot = ""; if($inDerWelt < 16) { $fullOrNot = "§aBeitreten"; } else { $fullOrNot = "§cVoll"; } $sign->setText($this->prefix, $this->levelName, TextFormat::AQUA."[".$inDerWelt."/16"."]", $fullOrNot); $this->schildRegistrieren = false; $player->sendMessage($this->prefix.TextFormat::GREEN."Du hast erfolgreich ein Schild für ".$this->levelName." gesetzt!"); $this->levelName = ""; The second line is the world name.. :/
Whats SchildRegistrieren? For werden t did you need it? German: Für was brauchst du SchildRegistrieren? Du kannst ja einfach die Linien abchecken
Forum = English only. + Understand the code before replying. Change PHP: $levelName = $level->getName(); to PHP: $levelName = $text[1];
Its for checking if the player will register a sign for an arena. Sorry, its an English only forum, I cant answer in German.
I Think You Forgot PHP: public function onEnable(){// code$this->getServer()->loadLevel($this->levelname);}