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

How to Display Popups

Comments in 'Plugin Development' started by DunxandMinecraft, May 7, 2015.

  1. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Hello,

    I am asking a short question. What's the code for popups in the new version of PocketMine

    Thanks,
    DuncanA
  2. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    PHP:
    $player->sendPopup($message);
  3. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Is that all the code?
  4. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    You can also do this
    PHP:
    $player->sendTip($message);
    It is similar to popup but it is higher up on screen.
  5. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Thanks
  6. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    :(
    Cool, now I know how to make this higher;)
  7. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    I think those type of messages appear when you enter a boat or minecart in MCPE.
  8. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    In the $message part can you put the message in there? Do you keep the $ or not?
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Learn PHP... -_-#
    iksaku likes this.
  10. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    I just want to know I think I keep the $
  11. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Isn't $ a var sign? You can first assign a text (Or whatever you programmers call it) then just put the var in.
    (I think....)
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $message means "an expression that is resolved into your desired message". It can be any expression, including $message if you defined it.
    Taha_The_Hacker and iksaku like this.
  13. andre_the_gamer
    Offline

    andre_the_gamer Active Member

    Joined:
    Feb 5, 2015
    Posts:
    112
    Minecraft User:
    Andre_The_Gamer
    You can defined it like this:
    PHP:
    $message "Hey this is a just an example";    
    $player->sendTip($message); 
    I hope i helped. :D
    DunxandMinecraft likes this.
  14. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    Or directly in the method..
    PHP:
    $player->sendTip("Blabla");
    DunxandMinecraft likes this.
  15. andre_the_gamer
    Offline

    andre_the_gamer Active Member

    Joined:
    Feb 5, 2015
    Posts:
    112
    Minecraft User:
    Andre_The_Gamer
    But, If you wanna save time or you have to send the same message again" You should use it
    PHP:
    $message "Hey This is just an example xD";
    $player->sendTip($message);  <-- So You Dont Have to rewrite
    $player
    ->sendTip($message);  <-- You can use the same varible
    Legoboy0215 likes this.
  16. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    There isn't any 'real time'... Computers do anything for you now. Copy and pasting will not spend you too much time. Anyway, getting off-topic. :)
    Thanks - GmWM
    Legoboy0215 likes this.
  17. andre_the_gamer
    Offline

    andre_the_gamer Active Member

    Joined:
    Feb 5, 2015
    Posts:
    112
    Minecraft User:
    Andre_The_Gamer
    Yep, :D Copy And Pasting is easy:rolleyes:
    Thanks - Copy / Paste:p
  18. CavinMiana
    Offline

    CavinMiana Active Member

    Joined:
    Aug 26, 2015
    Posts:
    101
    Minecraft User:
    CavinMiana
    This is if you want an item to have a popup!
    PHP:
    public function onHold(PlayerItemHeldEvent $event) {
       if(
    $event->getItem()->getId() == // I'd of item) {
            
    $event->getPlayer()->sendPopup("blah");
              
    // Just Put something else in the "blah" part
    }
    }
    Oh and please learn PHP it really helps. Please look at this code and think about how it works. Just don't copy and paste. Thx!:):p
    Last edited: Sep 25, 2015
  19. andre_the_gamer
    Offline

    andre_the_gamer Active Member

    Joined:
    Feb 5, 2015
    Posts:
    112
    Minecraft User:
    Andre_The_Gamer
    I dont think he ask to make the popup when the player is holden an item. :D

    I think he wanted to disply the popup when players join the server or at random times.... xD

    But you can always make it when a player join by using the playerJoinEvent
    and then you get get player name then send popup :p

    I Hope i helped :)
  20. CavinMiana
    Offline

    CavinMiana Active Member

    Joined:
    Aug 26, 2015
    Posts:
    101
    Minecraft User:
    CavinMiana
    No I was just telling him just in case he wants to do that to :p.

Share This Page

Advertisement