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

Error on code !

Comments in 'Plugin Development' started by XxD7omGamer, Jan 5, 2016.

  1. XxD7omGamer
    Offline

    XxD7omGamer New Member

    Joined:
    Jun 28, 2015
    Posts:
    38
    Minecraft User:
    XxD7omGamer
    [/PHP]
    Public function OnJoin(PlayerJoin Event $event){
    $p = $event->getPlayer();
    $p->setNameTag("§b§lLegend§cPvP§0 |.$player->getName());
    }

    Hello guys
    In this code is'n working
    What's the error ?
    ( sorry for eng bad )
    I'm arabic :)
  2. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    PHP:
    public function OnJoin(PlayerJoinEvent $event){
    $p $event->getPlayer();
    $p->setNameTag("§b§lLegend§cPvP§0"|$p->getName());
    }
    Try that
    and be sure to
    use pocketmine\event\player\PlayerJoinEvent;
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    PHP:
    public function OnJoin(PlayerJoinEvent $event){
    $p $event->getPlayer();
    $p->setNameTag("§b§lLegend§cPvP§0" $p->getName());
    }
  4. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Missed that :)
  5. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    I dont recommend using this sign (§) to display a certain text format, i would suggest doing this:
    PHP:
    public function OnJoin(PlayerJoinEvent $event){
    $p $event->getPlayer();
    $p->setNameTag(TextFormat::BOLD TextFormat::AQUA "Legend" TextFormat:: RED "PvP" Texformat::WHITE $p->getName());
    }
    dont forget to use pocketmine\utils\TextFormat :)
    KubixQ and Vaivez66 like this.
  6. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    It doesn't really matter what method you use. I find using "§" is faster.
  7. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    wait for @PEMapModder to hear about this xD
    KubixQ likes this.
  8. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Was that meant to reply to me?
  9. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    yeah, I accidently quoted my own message :p
  10. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    I prefer to use TextFormat since I can't found the "§" in my keyboard :p
    AndrewBit and zombie_Power like this.
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    § may be deprecated in MCPE in the future. @shoghicp is (or was) working on a change in color tags that makes it more tag-based.
    KubixQ, AndrewBit and Vaivez66 like this.
  12. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Well, well.
    But, where is that character on a QWERTY keyboard? lol
  13. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    Hold the alt key the press the #'s from 1-9 on the Key Pad
  14. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Also, TextFormat looks better!

Share This Page

Advertisement