public function tpallspawn($cmd, $args, $issuer){ $x = $mapname->entity->x; $y = $mapname->entity->y; $z = $mapname->entity->z; foreach($this->api->level->get->getSpawn() as $mapname){ $this->api->console->run("tp @all ".$mapname); $this->api->chat->broadcast("Teleported all players to spawn"); }
The fixed code: PHP: public function tpallspawn($cmd, $args, $issuer){$spawn = $this->api->level->getDefault()->getSpawn();$this->api->console->run("tp @all ".$spawn);$this->api->chat->broadcast("Teleported all players to spawn"); I hope it works like this. I haven't tested it.
This should work: Code: public function tpallspawn($cmd, $args, $issuer){ foreach($this->api->player->getAll() as $p) { $mapname = "nameofmap"; $this->api->level->loadLevel($mapname); $p->teleport($this->api->level->get($mapname)->getSpawn()); } }
You can use my tool to create a basic code. Just create a command and put your code in it. Look for it in the forums.