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?
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!
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.
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..
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.
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.