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

Count world players

Comments in 'Plugin Development' started by Legoboy0215, Jul 8, 2015.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    How do I count all the players in the world?
    I got this only:
    PHP:
    if($this->getServer()->getLevelByName("hg")->getPlayers().......
  2. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    PHP:
    $players count($this->getServer()->getLevelByName("hg")->getPlayers());
    Here.
  3. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    If you need make any action:
    PHP:
    if(count($this->getServer()->getLevelByName("hg")->getPlayers())==1){ //I use == for example
    //this your action
    }
    iksaku and Legoboy0215 like this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    This is obvious...
    Legoboy0215 likes this.
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    PHP:
    if(count($this->getPost()->getId()->getLikes()) == 3){ 
    $Asidert->sendMessage("This is too obvious...");
    }
  6. TonyDroide
    Offline

    TonyDroide Active Member Plugin Developer

    Joined:
    Jun 5, 2015
    Posts:
    122
    Plugins:
    1
    Minecraft User:
    TonyDroidd
    xD
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Fatal error: Trying to call member function getLikes of non-object on Forum post code line 1.
    TonyDroide and RekkuzaRage like this.
  8. RekkuzaRage
    Offline

    RekkuzaRage Active Member

    Joined:
    Apr 15, 2014
    Posts:
    251
    Minecraft User:
    RekkuzaRage
    You can detect errors without even testing it... @PEMapModder is a god.
  9. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    getPos? PocketMine or the fake getPost API?
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You know I didn't test it without asking me...
    @RekkuzaRage is a God.
    RekkuzaRage likes this.

Share This Page

Advertisement