i keep messing around with the } but it is annoying i can never get it right it is so fussy so here is the code case "tpallwarp": $data = $this->api->plugin->readYAML($this->api->plugin->configPath($this). "[TPALLWARPS].yml"); if (isset($params[0])) { $name = $params[0]; if (array_key_exists($params[0], $data)) { $x = $data[$params[0]][0]; $y = $data[$params[0]][1]; $z = $data[$params[0]][2]; $level = $this->api->level->get($data[$params[0]][3]); } } } } if ($name == true){ foreach(@all as $players){ $players->teleport(new Position($x, $y, $z, $level)); $issuer->sendChat("[TPALLWARP] all players have been warped!"); } } else { $issuer->sendChat("[SimpleWarps] Warp doesnt exists!"); } break; } public function __destruct() { } } ?>
Code: <?php /* __PocketMine Plugin__ name=tpall version=1.3 description=tps all player to you author=puzzleo class=tpall apiversion=7,8,9,10 */ class tpall implements Plugin{ private $api; public function __construct(ServerAPI $api, $server = false){ $this->api = $api; } public function init(){ $this ->api-> console->register("tpall", "tps all players", array($this, "tpall")); $this ->api-> console->register("tpallspawn", "tps all players to spawn", array($this, "tpallspawn")); $this ->api-> console->register("tpallcoords", "tps all players to curtin posistion", array($this, "tpallcoords")); $this ->api-> console->register("tpallcreatewarp", "tps all players to warp", array($this, "command")); $this ->api-> console->register("tpalldeletewarp", "tps all players to warp", array($this, "command")); $this ->api-> console->register("tpallwarp", "tps all players to warp", array($this, "command")); $this ->api-> console->register("coords", "tells player coords", array($this, "coords")); $this ->api-> console->register("tpalluser", "tps all players to user", array($this, "tpall")); $this->config = new Config($this->api->plugin->configPath($this)."[TPALLWARPS].yml", CONFIG_YAML, array()); console("[INFO] [TPALLWARPS] have Loaded!"); } public function tpall($cmd, $args, $issuer){ if($issuer == 'console'){ console("Please run this command in-game."); } else { $this->api->player->tppos("@all","$x","$y","$z"); $this->api->chat->broadcast("[TPALL]Teleported all players"); } } public function tpallspawn($cmd, $args, $spawn){ $spawn = $this->api->level->getDefault()->getSpawn(); $x = $spawn->x; $y = $spawn->y; $z = $spawn->z; $this->api->console->run("tp @all $x $y $z"); $this->api->chat->broadcast("[TPALL]Teleported all players to spawn"); } public function tpallcoords($cmd, $args, $params){ $locationX = $params[1]; $locationY = $params[2]; $locationZ = $params[3]; if (count($params) > 4) { $locationWorld = $params[4]; } else { $locationWorld = $this->api->level->getDefault(); } $location = new Position($locationX, $locationY, $locationZ, $locationWorld); $this->api->player->tppos("@all","locationX","locationY","locationZ"); $this->api->chat->broadcast("[TPALL]Teleported all players to coords"); } public function tpalluser($cmd, $args, $issuer){ $this->api->player->teleport("@all",".$issuer"); $this->api->chat->broadcast("[TPALL]Teleported all players to selected user"); } public function coords($cmd, $args , $issuer, $x, $y, $z , $level, $params, $rawx , $rawy , $rawz){ if($issuer == 'console'){ console("Please run this command in-game."); } else { $input =$params[0]; $rawx = floor($issuer->entity->x); $x=round($rawx,2); $rawy = floor($issuer->entity->y); $y=round($rawy,2); $rawz = floor($issuer->entity->z); $z=round($rawz,2); $level = $issuer->level->getName(); $output ="[TPALL]player is at X: $x Y: $y Z: $z in the world: $level"; return $output; } } public function command($cmd, $params, $issuer, $alias, $args, $issuer){ switch ($cmd) { case "tpallcreatewarp": if (isset($params[0])) { $data = $this->api->plugin->readYAML($this->api->plugin->configPath($this). "[TPALLWARPS].yml"); if (array_key_exists($params[0], $data)) { $issuer->sendChat("[TPALLWARPS] Warp has already been created with that name!"); }else { $name = $params[0]; $x = round($issuer->entity->x); $y = $issuer->entity->y; $z = round($issuer->entity->z); $level = $issuer->level->getName() ; $data["$name"] = array($x,$y,$z,$level); $this->api->plugin->writeYAML($this->api->plugin->configPath($this)."[TPALLWARPS].yml", $data); $issuer->sendChat("[TPALLWARPS] Warp hass been added!"); } } else { $issuer->sendChat("Usage: /tpallcreatewarp [NAME]"); } break; case "tpalldeletewarp": $data = $this->api->plugin->readYAML($this->api->plugin->configPath($this). "[TPALLWARPS].yml"); if (isset($params[0])) { if (array_key_exists($params[0], $data)) { unset($data[$params[0]]); $this->api->plugin->writeYAML($this->api->plugin->configPath($this)."[TPALLWARPS].yml", $data); $issuer->sendChat("[TPALLWARPS] Warp has been removed!"); }else { $issuer->sendChat("[SimpleWarp] Warp doesnt exist!"); } }else { $issuer->sendChat("Usage: /tpalldeletewarp [NAME]"); } break; case "tpallwarp": $data = $this->api->plugin->readYAML($this->api->plugin->configPath($this). "[TPALLWARPS].yml"); if (isset($params[0])) { $name = $params[0]; if (array_key_exists($params[0], $data)) { $x = $data[$params[0]][0]; $y = $data[$params[0]][1]; $z = $data[$params[0]][2]; $level = $this->api->level->get($data[$params[0]][3]); } } } } if ($name == true){ foreach(@all as $players){ $players->teleport(new Position($x, $y, $z, $level)); $issuer->sendChat("[TPALLWARP] all players have been warped!"); } } else { $issuer->sendChat("[SimpleWarps] Warp doesnt exists!"); } break; } public function __destruct() { } } ?> well it dosnt thing thee end break is wrong it is the if now
i know i am gonna change it i just want it to work in the first place so i have something to work off
now only to figure out what this means `` # PocketMine-MP Error Dump Tue Nov 26 08:18:23 GMT 2013 Error: array ( 'type' => 1, 'message' => 'Cannot break/continue 1 level', 'file' => 'C:\\Users\\Ivett\\Desktop\\PocketMine-MP\\src\\API\\PluginAPI.php(87) : eval()\'d code', 'line' => 155, )