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

Teleproting between worlds using FormAPI

Discussion in 'Development' started by Wolf-DEV, Apr 12, 2019.

  1. Wolf-DEV

    Wolf-DEV Creeper

    Messages:
    4
    GitHub:
    th3wolf23dev
    HI,
    I'm trying to make my lobby core but I'm stuck at teleporter part i tried to run a command from other plugins to teleport players using dispatchcommand but it didn't seem to work.

    any help?
     
    Last edited: Apr 12, 2019
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    If you merely want to teleport a player, you don't need to run commands. Just call teleport() on the player.
     
  3. Wolf-DEV

    Wolf-DEV Creeper

    Messages:
    4
    GitHub:
    th3wolf23dev
    @SOFe I mean between worlds

    if so can you give an example plz?
     
  4. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    You can teleport the player using teleport shown below:
    PHP:
    $player->teleport(new Position($x$y$z);
    To teleport across worlds I recommend you do something like this:
    PHP:
    $player->teleport(new Position($x$y$z$this->getServer()->getLevelByName($world)));
    Where you define $world, $x, $y, and $z before hand.
    In addition to make the transition to another world as smooth and as lag free as possible I'd recommend that you load the level before teleportation or on startup in the pocketmine.yml file.
     
    jasonwynn10 and HimbeersaftLP like this.
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    what's the difference between Vector3 and Position when teleporting
     
  6. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    one specifies a world, the other does not
     
  7. Wolf-DEV

    Wolf-DEV Creeper

    Messages:
    4
    GitHub:
    th3wolf23dev
    Thanks for showing me this and how do i add UI?
     
  8. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    It depends on how you want to send the UI to the player.
    Are you using FormAPI?
     
  9. Wolf-DEV

    Wolf-DEV Creeper

    Messages:
    4
    GitHub:
    th3wolf23dev
    @mcpeatch Yes i use FormAPI
     
  10. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
  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.