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

World Teleportation

Discussion in 'Plugin Help' started by TwistedFellow, Aug 22, 2019.

  1. TwistedFellow

    TwistedFellow Silverfish

    Messages:
    22
    GitHub:
    SilverzPlayz
    How do I make it if someone presses a FormApi button it teleports them to the "Default Spawn Level of a certain world"
    What code to I put into my "Case 0:" to make it teleport???
     
  2. ShushImSam

    ShushImSam Spider Jockey

    Messages:
    37
    PHP:
    $f = function (Player $player$data null) {
                                switch (
    $data) {
                                    case 
    0:
                                      
    $player->teleport($this->getServer()->getDefaultLevel()->getSpawn());
                                        break;
                                }
                            };
     
  3. TwistedFellow

    TwistedFellow Silverfish

    Messages:
    22
    GitHub:
    SilverzPlayz
    No I want to be able to teleport to a different worlds default level spawn point
     
  4. ShushImSam

    ShushImSam Spider Jockey

    Messages:
    37
    getLevelByName("Name") instead of DefaultLevel
     
  5. Fadhel

    Fadhel Witch

    Messages:
    68
    GitHub:
    dimbis
    Note: $player is the player variable
    PHP:
    $player->teleport($this->getServer()->getLevelByName("YourWorld")->getSafeSpawn());
     
  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.