Hey people of the forums, I'm trying to make a pligip where when they do /arena it teleports them to a new world, and a random coord. ive dine the command but idk how to teleport the player PHP: $x = mt_rand(1, 100);$y = 50;$z = mt_rand(1, 100);$level = $this->getServer()->getLevelByName("Arena");// how to teleport to the place?
You can use this PHP: $sender->teleport(new Position($x,$y,$z,$level));$sender->sendMessage(TextFormat::GREEN . "Teleporting to Arena");
PHP: $level = $player->getLevel();$rand = mt_rand(-1000, 1000);$x = $player->x+$rand;$z = $player->z+$rand;$y = $level->getHighestBlockAt($x,$z);$pos = new Vector3($x,$y+1,$z);$this->player->teleportImmediate(new Position($x,$y,$z,$level));