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

teleport()

Comments in 'Plugin Development' started by IronPony, Dec 12, 2013.

  1. IronPony
    Offline

    IronPony Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    93
    Plugins:
    4
    Minecraft User:
    1ron_pon3
    As I understand, to teleport player between worlds, I should use
    PHP:
    teleport(new position(coords here));
    But what is the format of coords?
    I have tried "x, y, z, level" and "level, x, y, z". It didn't work for me :(
  2. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    I think (yes, i only think) it works like this

    PHP:
    $playerobject->teleport(new Vector3($x$y$z$level)); 
  3. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Level being the level object
  4. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Yes, but Vector3 needs to be Position
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I advise you to do directly
    PHP:
    # Use if needed: $player=$issuer->username;
    # Define $x, $y and $z (and $level if necessary)

    # Use if needed: $this->api->console->run("tp $player w:$levelName");
    $this->api->console->run("tp $player $x $y $z");
    Saves lots of trouble messing with classes.
    Last edited: Dec 17, 2013
  6. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    $player would have to be the username not the object
    PEMapModder and wies like this.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement