Need help with teleport

Discussion in 'Development' started by PotatoeTheDev, Feb 13, 2018.

  1. PotatoeTheDev

    PotatoeTheDev Witch

    Messages:
    63
    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 Silverfish

    Messages:
    20
    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 Witch

    Messages:
    63
    GitHub:
    potatoetrainyt
    oo thanks
     
  5. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    151
    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));
     
    OnTheVerge and Kenn Fatt like this.
  6. Daniktheboss

    Daniktheboss Baby Zombie

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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.