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

Send messgae to all players

Comments in 'Plugin Development' started by deot, Nov 6, 2015.

Thread Status:
Not open for further replies.
  1. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Hi, does anyone know how to send a message to all players?
    My current code:
    PHP:
    public function(...){
        
    $this->msgAllPlayers(TextFormat::RED."Test"//$p at here isnt represent all player)
    }
    public function 
    msgAllPlayers($messagePlayer $p){
        
    $p->sendMessage($message);
    }
    In the upper function, the $p is declared as $p = $e->getPlayer the player who break block.. (in BlockBreakEvent)...
    So, if i put $p in msgAllPlayers, i think it will just message to the person who break block only...
  2. basprohop
    Offline

    basprohop Active Member Plugin Developer

    Joined:
    Aug 8, 2015
    Posts:
    128
    Plugins:
    3
    Minecraft User:
    basprohop
    How do you have a plugin?
    Gamecrafter likes this.
  3. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
    $this->getServer()->broadcastMessage("Your message here")

    lol, pretty simple
  4. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Opps... Yeah, i do learn PHP... But gives newbie some time to get well of it... zzz

    Oh!? Theres boardcastMessage()? xD
    So? Like this:
    PHP:
    $this->getOwner()->getServer()->broadcastMessage("Test")
  5. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    i think u missed getOwner()
  6. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    How do I have a plugin? I make it... LOL?
    #StrangeQuestion... xD
  7. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Look at the docs next time? #ReadTheDocs
    It depends on where you call that method, so you are wrong.
    Taha_The_Hacker and deot like this.
  8. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Yeah, read the docs... :)
    But everytime i go read the docs at docs.pocketmine.net...
    Some docs doesnt completed or i can say outdated...
  9. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    getOwner() is for tasks.
    Taha_The_Hacker and deot like this.
  10. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    You have a "Plugin Developer" tag, but you don't know how to send broadcast message...weird -_-
    Taha_The_Hacker and Gamecrafter like this.
  11. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Hmmm... I don't use the docs, but I use it only when I'm lazy(which is never). Nowadays I look through the PocketMine source code on GitHub, and you should, too. https://github.com/PocketMine/PocketMine-MP
    deot likes this.
  12. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Doesnt meant that Plugin Developer will know 100% of the Pocketmine API!..
    Just like our real life,
    Doesnt mean that a school teacher know all the stuffs around the world
    Doesnt mean that a chef will know how to cook all kind of dishes
    Doesnt mean that your mom will know you for 100%
    So, let me ask you again, does it wierd? :p
    Hotshot_9930 likes this.
  13. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    Chill out, man...:p
  14. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    I didnt angry... zzz xD :p
    Still thank you guys for solving my problem xD Yeah, a classic one #ReadTheDocs...
Thread Status:
Not open for further replies.

Share This Page

Advertisement