1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Need help with teleport

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

  1. TwistedAsylumMC

    TwistedAsylumMC Slime

    Messages:
    96
    GitHub:
    twistedasylummc
    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:
    106
    GitHub:
    AffanStarPure
    You can use this
    PHP:
    $sender->teleport(new Position($x,$y,$z,$level));
    $sender->sendMessage(TextFormat::GREEN "Teleporting to Arena"); 
     
  4. TwistedAsylumMC

    TwistedAsylumMC Slime

    Messages:
    96
    GitHub:
    twistedasylummc
    oo thanks
     
  5. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    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:
    144
    GitHub:
    daniktheboss
    I use this code for my /wild. This should work nicely
     
  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.