I am Working on many minigames but Stuck at the same thing , the thing is I cant teleport players at different positions because the plugin teleports all to the same coords , how can i setup coords for Dach player or is there a way to give ans player a ID ($player1 , $player2 ...etc.) or else Plesse help sry for my Bad english , I Bad some problems with pocketmine , there are no many Herman guys they can teach me that xD
I am want to say that a Countdown Start and after it so if seconds == 0 blabla then teleport each player in the world to a different location , or die you think thats not work ? I think its work with a variable $players but dont know how to ADD and remove and check if a player is in the array or variable
I still dont fully understand what you're saying but... Give each player an ID and give each ID certain coordinates to be teleported to. It would look something like this: PHP: if($playerID == 1) { $pos = new pocketmine\level\Position($x, $y, $z, $level);}if($playerID == 2) { $pos = new pocketmine\level\Position($x, $y, $z, $level);}// etc...$player->teleport($pos);
OK so but i dont Knie how i can give the players the IDS , or why should you have one variable with different numbers , i think its work only with a variable for each player , but can you say me how to add a player to playerID , i think there is after it the Problem if a player quit ...
You can do this in many ways, but to do it with YAML: PHP: public function onEnable() { @mkdir($this->getDataFolder(). "ID's/"); $this->lastRegistered = new Config($this->getDataFolder() . "Last-Registered-ID.yml", Config::YAML, array( "Last.Registered" => 0 )); } public function getLastRegisteredID() { return $this->lastRegistered->get("Last.Registered"); } public function registerPlayerID($playerName) { $id = $this->getLastRegisteredID()++; $this->player = new Config($this->getDataFolder() . "ID's/" . strtolower($playerName) . ".yml", Config::YAML, array( "Player.ID" => $id )); $this->lastRegistered->set("Last.Registered", $this->player->get("Player.ID")); $this->lastRegistered->save(); } public function getPlayerID($playerName) { $this->player = new Config($this->getDataFolder() . "ID's/" . strtolower($playerName) . ".yml", Config::YAML); return $this->player->get("Player.ID"); } I havent tested this.
Oh its hard , hmm so is there a easy way tha i can say : onCommand If cmd == "join" bla Then $player1 = $sender->getName(); And the next one they do join add the Name to a other variable , so its enough that i have a variable for each player so i can say : $player1->teleport blabla coords 1,2,3 usw And $player2->teleport.... Is that works?
Its easy to say it , but i am didnt und er stand english so gold so there are no good tutorials to learn PHP and pocketmine
Why must he learn PHP and pocketmine API, when you even aren't able to code [perfectly]. That is why there is a "Plugin Development" created to help beginners... BY simply asserting "Learn PHP and pocketmine API", you have just shown that the same goes for you, as you haven't provided him with a valid answer.
This forum is for helping with the API, not for PHP. This is PocketMine Forums. PHP is not PocketMine.
I will teleport every player in example : every player in SG should teleport to editable coordinates , but dont know how ;/
How did you mean it ? So if i do : Public function getNextSpawn(){ bla And if i do in the shedule $this->getNextSpawn(); the function Call one time vor what?