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

How to find the number of players in a world (lobby)

Discussion in 'Development' started by Theo gillespie, Nov 14, 2017.

  1. Theo gillespie

    Theo gillespie Spider

    Messages:
    13
    Hello, I am wondering how to make a code know how many players are in a world and when to start the game, I am new to pho and need help


    Thanks in advance
     
  2. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    You mean that?
    PHP:
    $arena "Name of the world";
    $levelArena $this->getServer()->getLevelByName($arena);
    $aop count($levelArena->getPlayers());
    $player->sendMessage("World players count: ".$aop."");
     
  3. Theo gillespie

    Theo gillespie Spider

    Messages:
    13
    Yes, thanks but how do I now when to start the game when there are, say 4 players
     
  4. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    use an if statement to compare the count of the players in the level to the amount of players you want when the game starts
     
  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.