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

Need help with teleport

Discussion in 'Development' started by PotatoeTheDev, Feb 13, 2018 at 10:13 AM.

  1. PotatoeTheDev

    PotatoeTheDev Spider

    Messages:
    12
    GitHub:
    potatoetrainyt
    Hey people of the forums, I'm trying to make a pligip where when they do /arena it teleports them to a new world, and a random coord.
    ive dine the command but idk how to teleport the player
    PHP:
    $x mt_rand(1100);
    $y 50;
    $z mt_rand(1100);
    $level $this->getServer()->getLevelByName("Arena");
    // how to teleport to the place?
     
  2. Herojhjh

    Herojhjh Spider

    Messages:
    13
    GitHub:
    herojhjh
    $player->teleport()
     
  3. AffanStarPure

    AffanStarPure Baby Zombie

    Messages:
    103
    GitHub:
    AffanStarPure
    You can use this
    PHP:
    $sender->teleport(new Position($x,$y,$z,$level));
    $sender->sendMessage(TextFormat::GREEN "Teleporting to Arena"); 
     
  4. PotatoeTheDev

    PotatoeTheDev Spider

    Messages:
    12
    GitHub:
    potatoetrainyt
    oo thanks
     
  5. Daniktheboss

    Daniktheboss Spider Jockey

    Messages:
    48
    GitHub:
    daniktheboss
    PHP:
    $level $player->getLevel();
    $rand mt_rand(-10001000);
    $x $player->x+$rand;
    $z $player->z+$rand;
    $y $level->getHighestBlockAt($x,$z);
    $pos = new Vector3($x,$y+1,$z);
    $this->player->teleportImmediate(new Position($x,$y,$z,$level));
     
    Kenn Fatt likes this.
  6. Daniktheboss

    Daniktheboss Spider Jockey

    Messages:
    48
    GitHub:
    daniktheboss
    I use this code for my /wild. This should work nicely
     

Share This Page