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

JoinTip

Comments in 'Plugin Development' started by Skullex, Jan 21, 2016.

  1. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I have recently coded this
    PHP:
    <?php

    namespace Tip;

    use 
    pocketmine\plugin\PluginBase;

    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\network\protocol\TextPacket;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\level\sound\BlazeShootSound;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }

        public function 
    onJoin(PlayerJoinEvent $event){
        
    $p $e->getPlayer();
        
    $fizz = new BlazeShootSound($p);
        
    $p->sendTip(TextFormat::YELLOW TextFormat::BOLD TextFormat::RESET "StrongHold Minigames");
        
    $p->getLevel()->addSound($fizz);
       }
    }
    ?>

    I need someone to correct me
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    SHOW_ERROR
  3. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    pocketmine\network\protocol\TextPacket is unused.
    applqpak and Skullex like this.
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    <?php

    namespace Tip;

    use 
    pocketmine\plugin\PluginBase;

    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\level\sound\BlazeShootSound;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }

        public function 
    onJoin(PlayerJoinEvent $event){
            
    $p $event->getPlayer();
            
    $fizz = new BlazeShootSound($p);
            
    $p->sendTip(TextFormat::YELLOW TextFormat::BOLD TextFormat::RESET "StrongHold Minigames");
            
    $p->getLevel()->addSound($fizz);
        }
    }
    PocketKiller, applqpak and Skullex like this.
  5. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I know that but it didn't work before I entered that
  6. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Ty
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    The problem was that you used $e instead of $event, so Undefined variable
    Skullex likes this.
  8. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
    You need to get the player's location.

    PHP:
    $fizz = new BlazeShootSound($p->getLocation());
    applqpak and Skullex like this.
  9. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    You guys are amazing, ty :D
    applqpak, PocketKiller and XFuryMCPE like this.
  10. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    $p is a Location itself.
  11. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Thanks allot! :D
  12. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Skullex likes this.
  13. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
  14. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Thanks for all your help aswell :D
    XFuryMCPE likes this.
  15. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
    No problem, even though it looks like everything I said was useless xD
    Skullex likes this.
  16. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Lol
  17. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    he can use $e if he type
    PHP:
    public function onJoin(PlayerJoinEvent $e){
    not

    Code:
    public function onJoin(PlayerJoinEvent $event){
    CraftingMania likes this.
  18. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Thank you, we all know that your mother is a woman.
    CraftingMania and PocketKiller like this.
  19. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    i just replied to pocketkiller
    CraftingMania likes this.

Share This Page

Advertisement