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

Solved moving popup

Discussion in 'Development' started by KHAV, May 24, 2017.

  1. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    Hello

    How i can when example send popup moving it to any direction?

    :)
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    please be more descriptive...
    do you meant moving popup location or animated popup
     
  3. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    oh i am sorry

    yes i want moving popup location
     
  4. [deleted]

    [deleted] Guest

    So u want a popup showing Player's Location?
     
  5. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    I think he means he wants to move the pop-up to other places on the screen, not just stand on top of the hotbar
     
  6. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    yes i mean it
     
  7. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    no i want move the popup to other places not just stand on top of hotbar
     
  8. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    Use spaces and "\n" with tasks
    PHP:
    <?php
    namespace your\name\space;

    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\Plugin;
    use 
    pocletmine\scheduler\PluginTask;

    class 
    pop-up-task extends PluginTask{

        public 
    $turn 0;
      
        public function 
    __construct(Plugin $mainPlayer $player){
            
    $this->player $player;
            
    $this->plugin $main;
            
    parent::__construct($main$player);
        }
        public function 
    onRun($tick){
            
    $this->turn++; //add 1 to $turn
            
    if($this->turn == 1){
             
    $player->sendPopup("Ho");
            }
            if(
    $this->turn == 2){
              
    $player->sendPopup("Ho".str_repeat("\n"10));
            }
            if(
    $this->turn == 3){ // or any number u want
              
    $this->plugin->getServer()->getScheduler()->cancelTask($this->getTaskId()); // cancel the task
            
    }
    And describe your problem more detailed next time
     
    jasonwynn10 likes this.
  9. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    thx it is working
     
    Az928 likes this.
  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.