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

Solved teleport player different position .

Comments in 'Plugin Development' started by Ritch, Feb 14, 2016.

  1. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    Hi guys, How To teleport a player différents position
    $player1->teleport (....
    And $player2->teleport(....
  2. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    (Plugin Développement)
  3. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    Link ? Sorry you not help me :/
  4. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    PHP:
    /*
    * @param Player $player
    * @param Level $level
    * @param Level $level2
    */
    if($player->getName() == "Pedro"){
    $player->teleport($level->getSafeSpawn());
    } elseif(
    $player->getName() == "Papichulo"){
    $player->teleport($level2->getSafeSpawn());
    }
    Ritch likes this.
  5. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    I like your code :) I search position teleport as HungerGame :/ with vector3
    PHP:
    if(count($this->players >= 1)){
      
    $x $this->cfg->get("player_join_x");
      
    $y ect....... 
  6. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    if(count($this->players) == 1){
    $player->teleport(new Vector3($x,$y,$z));
    }
    Omar2s2 likes this.
  7. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    and if(count($this->players) == 2); ?? For Two Player ? Duel ? And level ?
  8. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    if(count($this->players) == 2){$player->teleport(new Vector3($x,$y,$z));
    }


    use count($this->players)
    Last edited: Feb 14, 2016
    Omar2s2 and Ritch like this.
  9. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    With level code please thank For help!
  10. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    Do You Want To Teleport to another world
    if yes
    use Position
    Omar2s2 likes this.
  11. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    I search with another World please code :) And I solved my problem
    Omar2s2 likes this.
  12. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    $player->teleport(new Position($x,$y,$z,$this->getServer()->getLevelByName("name")));
    Omar2s2 likes this.
  13. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    PHP:
    $w "yourworld";
    if(
    count($this->getServer()->getLevelByName($w)) == 10){
    //execute event (teleport to another world [xyz])
    }
    elseif(
    count($this->getServer()->getLevelByName($w)) == 9){
    //execute event (teleport to another world [xyz])
    }
    //..
    Or you can use config/Database : save number of player and get if number is [..] and set number -1 etc
    Last edited: Feb 14, 2016
  14. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    why use config he can use array -.-

    and why 9 , 10 he want 1 , 2
    Last edited: Feb 14, 2016
    Omar2s2 likes this.
  15. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    yes array is well . I said the config or database but that was just an example ^^
  16. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    Stop learn php
    Omar2s2 likes this.
  17. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    because i use playerinteractevent And my problem the playet click = crash !
  18. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    because i use playerinteractevent And my problem the player
    click = crash !
  19. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    what does this do with PHP?
  20. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    You use Interact? If you want simple code use :

    PHP:
        $p->teleport(new Position(rand($r),$r2,rand($r), $this->getServer()->getLevelByName($world)));

Share This Page

Advertisement