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

give item for all players

Discussion in 'Development' started by Hen1, Oct 28, 2017.

  1. Hen1

    Hen1 Silverfish

    Messages:
    21
    execute a command and give an item to all players
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Please provide more information :D
    You mean all players on server?
    Also have you any previsious attempt to do it?
     
  3. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Just use
    PHP:
    /*
     * @var Item $item
     */
    foreach($this->getServer()->getOnlinePlayers() as $player) {
        
    $player->getInventory()->addItem($item);
    }
    to give all players on your server $item.
     
    Last edited: Oct 29, 2017
    Hen1 likes this.
  4. Hen1

    Hen1 Silverfish

    Messages:
    21
    thank you!
     
  5. Hen1

    Hen1 Silverfish

    Messages:
    21
    [QUOTE = "Kyd, post: 40692, member: 597"] Por favor forneça mais informações : D
    Você quer dizer todos os jogadores no servidor?
    Também tem alguma tentativa previsível de fazê-lo? [/ QUOTE]
    sim para todos que estão online
     
  6. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Speak english
     
    jasonwynn10 and LewBr like this.
  7. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    Lmao :D:confused: you don't like other languages.. :shoghi:
     
    Levi likes this.
  8. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    It's not about not liking other languages. It is about not understanding them.
     
  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.