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

Foreach players online

Comments in 'Plugin Development' started by Guillaume351, Mar 4, 2014.

  1. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    How to do a foreach players online $this->api->console->run("command " .$eachplayer);
    Thank you
  2. Kripto
    Offline

    Kripto New Member

    Joined:
    Mar 2, 2014
    Posts:
    15
    Minecraft User:
    Kripto96
    PHP:
    foreach($this->api->player->getAll() as $p) {

     
    //your command for the player $p
     
    $p->//action

    //This can work:
     
    $this->api->console->run("command " .$p);
    }
  3. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
  4. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Use $p->username in the command, other than just $p.
    Darunia18 likes this.

Share This Page

Advertisement