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

Send Loading screen when doing /hub

Discussion in 'Development' started by Harviy11, Nov 15, 2016.

  1. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    Guys how to send loading screen to player when they do /hub
    I am using this: (i know this dont work)
    PHP:
    elseif($cmd[0] === "/hub"){
    $player->getInventory()->clearAll();
    $player->getLevel()->addSound(new EndermanTeleportSound($player));
    $event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn());
    $this->getLevel()->getDimension();
    $this->setRank($player);
    $this->Items($player);
    $event->setCancelled(true);
    PLEASE HELP
     
    Last edited by a moderator: Nov 16, 2016
  2. imYannic

    imYannic Baby Zombie

    Messages:
    113
    Implement this into your code:
    PHP:
    $pk = new ChangeDimensionPacket();
    $pk->dimension $player->getLevel()->getDimension();
    $pk->$player->getX();
    $pk->$player->getY();
    $pk->$player->getZ();
    $player->dataPacket($pk);
    And remove
    PHP:
    $this->getLevel()->getDimension();
    It doesn't do anything.
     
    Last edited: Nov 15, 2016
  3. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    do not work :D
     
  4. imYannic

    imYannic Baby Zombie

    Messages:
    113
    It works, I tested it.
     
  5. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    is this god?
    PHP:
       elseif($cmd[0] === "/hub"){
           
    $player->getInventory()->clearAll();
           
    $player->getLevel()->addSound(new EndermanTeleportSound($player));
           
    $event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn());
           
    $pk = new ChangeDimensionPacket();
           
    $pk->dimension $this->getLevel()->getDimension();
           
    $pk->$player->getX();
           
    $pk->$player->getY();
           
    $pk->$player->getZ();
           
    $this->dataPacket($pk);
           
    $this->setRank($player); 
           
    $this->Items($player);
           
    $event->setCancelled(true);
     
    Last edited by a moderator: Nov 16, 2016
  6. imYannic

    imYannic Baby Zombie

    Messages:
    113
    Change $this->dataPacket($pk); to $player->dataPacket($pk);
     
  7. imYannic

    imYannic Baby Zombie

    Messages:
    113
    Does it even get triggered?
     
  8. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
  9. imYannic

    imYannic Baby Zombie

    Messages:
    113
    I tested it again, works.
     
  10. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    not for me :( Can you create for me plugin with this function ? xD
     
  11. Vaivez66

    Vaivez66 Spider

    Messages:
    12
    GitHub:
    Vaivez66
    It's $player->getLevel()->getDimension(), not $this->getLevel()->getDimension()
     
  12. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    Thanks i test it!:)
     
  13. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    Please be aware that support for Genisys or other distributions will not be provided on these forums. You may discuss distributions on off-topic.

    Level->getDimension() does not currently exist in PocketMine-MP.
     
  14. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    Now im using this
    PHP:
       elseif($cmd[0] === "/hub"){
           
    $player->getInventory()->clearAll();
           
    $event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn());
           
    $this->setRank($player);
           
    $pk = new ChangeDimensionPacket();
           
    $pk->dimension $player->getLevel()->getDimension();
           
    $pk->$player->getX();
           
    $pk->$player->getY();
           
    $pk->$player->getZ();
           
    $player->dataPacket($pk); 
           
    $this->Items($player);
           
    $event->setCancelled();
    but when i do /hub it send loading screen but there is one problem.... Loading screen do not end. loading screen is sending xxx hours (sorry for my bad english) please help
     
    Last edited by a moderator: Nov 16, 2016
  15. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Use [php] tags!
     
    HimbeersaftLP likes this.
  16. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    it is php tag
     
  17. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Because I edited it for you?
     
  18. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
  19. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    You should have added [PHP ][/PHP ] around your code so people can read it properly. SOFe edited it for you.
     
    HimbeersaftLP likes this.
  20. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    oh sorry
    [PHP ]
    elseif($cmd[0] === "/hub"){
    $player->getInventory()->clearAll();
    $event->getPlayer()->teleport(Server::getInstance()->getLevelByName("spawn")->getSafeSpawn());
    $this->setRank($player);
    $pk = new ChangeDimensionPacket();
    $pk->dimension = $player->getLevel()->getDimension();
    $pk->x = $player->getX();
    $pk->y = $player->getY();
    $pk->z = $player->getZ();
    $player->dataPacket($pk);
    $this->Items($player);
    $event->setCancelled(); [/PHP ]
    please help:D
     
  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.