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

Tp players to the spawn of a level

Discussion in 'Development' started by WEATHERCRAFTYT1, Aug 3, 2020.

  1. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
    hello i want to make it that players are teleported to the world spawn point in a different level . I am doing this for a plugin (minigame)
    PHP:
     if($time == 480)

                                    {

                                        foreach(
    $playersArena as $pl)

                                        {

                                            
    $pl->sendMessage("§e>§e--------------------------");

                                                                                    
    $pl->sendMessage("§e>§bDeathmatch is starting! 5 mintues untill the game ends!");

                                                                                    
    $pl->sendMessage("§e>§e--------------------------");

                                        }

                                        
    $this->refillChests($levelArena);

                                    }

                                    if(
    $time>=180)

                                    {

                                    
    $time2 $time 180;

                                    
    $minutes $time2 60;
    where it is Deathmatch is starting is where i want to put it
     
  2. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Code:
    /** @var Level $level */
    $level = Server::getInstance()->getLevelByName("YourWorld");
    /** Player $player */
    $player->teleport($level->getSafeSpawn());
     
    Primus likes this.
  3. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
  4. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    change prefix to SOLVED
     
  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.