Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Spawn players at other positions in shedule

Comments in 'Plugin Development' started by Bluplayz, Oct 25, 2015.

  1. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    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
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    What are you trying to do exactly?
  3. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    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
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    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);
  5. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    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 ...
  6. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    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.
    Last edited: Oct 26, 2015
  7. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    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?
  8. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Yu want to do HG?
  9. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    Learn php and pocketmine api ...
  10. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Same to you. Please don't reply if you are not answering the thread's question.
  11. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    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
  12. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    Yes and Jump League , i need it for many minigames with timer etc.
  13. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    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.
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    This forum is for helping with the API, not for PHP. This is PocketMine Forums. PHP is not PocketMine.
    Taha_The_Hacker likes this.
  15. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    I wasn't talking about php, I was only referring to TheMasks' quote
  16. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    You want players to be teleported to random locations?
  17. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    I will teleport every player in example : every player in SG should teleport to editable coordinates , but dont know how ;/
  18. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Make a function and every time you call ther unction $spawns used plus 1.
  19. Bluplayz
    Offline

    Bluplayz Active Member

    Joined:
    Aug 20, 2015
    Posts:
    74
    Minecraft User:
    Bluplayz
    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?
  20. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Sie case: spawn1 and Define it

Share This Page

Advertisement