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

How do i make a ranks plugin?

Discussion in 'Plugin Help' started by Indexfire, Jan 2, 2017.

  1. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    Hi, im back again. I learned basic php and pocketmine and i can make some basic stuff like commands but i have no idea how to give players a rank prefix in game. Anyone know how to make it?
     
  2. xZeroMCPE

    xZeroMCPE Witch

    Messages:
    67
    GitHub:
    xZeroMCPE
    Store ranks in a yml file, or json, or even mysql..

    Store player ranks in a file, any...
    When player chats, set the format, etc.... etc....

    Oh and, that's the wrong section.... Use the plugin dev section!
     
    InspectorGadget and applqpak like this.
  3. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    But how do i make a prefix
     
  4. xZeroMCPE

    xZeroMCPE Witch

    Messages:
    67
    GitHub:
    xZeroMCPE
     
    applqpak likes this.
  5. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    I would set the player custom display name, I'll add a snippet of code below to show you how.
    PHP:
    <?php
    $player
    ->setDisplayName("My Rank" $player->getName());
    //$player MUST be an instance of pocketmine/Player.
    //Player::getName() always returns a string
    //Player::setDisplayName() always requires a string as the argument.
     
    Last edited: Jan 2, 2017
    Bluplayz, archie426, applqpak and 3 others like this.
  6. xZeroMCPE

    xZeroMCPE Witch

    Messages:
    67
    GitHub:
    xZeroMCPE
    Well, "prefix" can be situated in many ways, he never said where...

    But what you've provided is also right, but we have no idea the particular place or position he wants it at.
    It could be in nametag, chat, etc..
     
    applqpak, HimbeersaftLP and 0x15f like this.
  7. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    Very True, Player::setDisplayName() sets the players displayed name in chat. If he was more specific on where the prefix should be, we could have provided more help.
     
  8. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Didn't you write setcustomname in the code snippet?
     
    applqpak likes this.
  9. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    My mistake :) .
     
    applqpak and HimbeersaftLP like this.
  10. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Still wrong here: :p
     
    applqpak and 0x15f like this.
  11. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    My mistake again :) . I'm a mess :shoghi:
     
    applqpak and HimbeersaftLP like this.
  12. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    Erm, nametag, chat prefix basically all of them
     
  13. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    Wait is the orange text part of the code or is it just there to explain what it is?
     
  14. applqpak

    applqpak Spider Jockey

    Messages:
    27
    GitHub:
    applqpak
    You stated you knew basic PHP, you don't know what a comment is....? Do you even know OOP?
     
    0x15f and xZeroMCPE like this.
  15. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    I'm the worst Pocketmine coder on this forums so forgive me if I'm an idiot
     
  16. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    There is nothing to forgive :)
    You should just try to start learning general programming, then OOP, then PHP, and then come back here for API questions, if you weren't able to read PM's src code by yourself already.
     
    Last edited: Jan 3, 2017
    applqpak and 0x15f like this.
  17. archie426

    archie426 Baby Zombie

    Messages:
    130
    GitHub:
    archie426
    Just make sure to not say 'I know the basics of PHP' next time
     
    applqpak, Jack Noordhuis and Magicode like this.
  18. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    I do know some php so you technically cant say im lying
     
  19. Dog2puppy

    Dog2puppy Slime

    Messages:
    94
    GitHub:
    colesquared
    Just remember // is a comment. :)
    PHP:
    $thisIsCode// This is a comment
     
    applqpak likes this.
  20. Primus

    Primus Zombie Pigman

    Messages:
    749
    Sorry for being a douchebag for pointing this out, but shouldn't your learn PHP and then OOP? :D
     
    HittmanA and applqpak like 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.