Hello Guys, i wanted to use some experimental options, and as the title said, im trying to change the player tag color when they execute the command, but... i investigated already and it does not gives me any results!! help please!!
PHP: $player = //Declare player, yada yada yada;$player->setNameTag("§a$player"); //§a is green, change it to something else if you would like.
Actually, yeah, i make my code, this is not just PHP, this is Pocketmine API, learn definitions men, good luck
If you really know PHP, you should know that a variable cannot be defined from nothingness. You didn't define $player. You can't blame it on the API, because superglobals only exist in PHP for the default ones ($_REQUEST, $_GET, $_POST, $GLOBALS, $_SESSION, $_FILES). Please learn PHP and learn the basics about variables.
PHP: public function onCommand(CommandSender $sender, Command $command, $label, array $args){if(strtolower($command->getName()) === 'nametag'){if(isset($args[0])){switch(strtolower($args[0])){case "blue"case "bl":$sender->setNameTag(TextFormat::BLUE.$sender->getDisplayName());$sender->sendMessage('Your name tag is now blue');}}}}