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

Solved SetNameTag

Comments in 'Plugin Development' started by FlamingGenius, Oct 2, 2015.

Thread Status:
Not open for further replies.
  1. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    $player->setNameTag("name");
  2. FlamingGenius
    Offline

    FlamingGenius Active Member

    Joined:
    Sep 23, 2015
    Posts:
    173
    Minecraft User:
    FlamingGenius
    Its kinda self explanatory look at the link @Gamecrafter posted
  3. FlamingGenius
    Offline

    FlamingGenius Active Member

    Joined:
    Sep 23, 2015
    Posts:
    173
    Minecraft User:
    FlamingGenius
    Update my code no errors now

    PHP:
    <?php

    namespace FlamingGenius\ColorTag;

    use 
    pocketmine\utils\Config;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Player;
    use 
    pocketmine\entity\Entity;

    class 
    ColorTag extends PluginBase{

     public function 
    onCommand(CommandSender $senderCommand $command$label, array $args){
     
    $player $this->getServer()->getPlayer();
     
    $cmd $this->command->getName();
     
    $tag $args;
     
    $config $this->getConfig()->get("tags");
     if(
    $tag == $config){
      if(
    strtolower($cmd) == "st"){
       
    $setTag $this->getConfig()->get($tag);
       
    $player->setNameTag($setTag);
      }
     }
      else{
       
    $sender->sendMessage("┬žbTag not reconized");
      }
     }



    }


    ?>
  4. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    yea it is quite self-explanatory but there are several other functions too
  5. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    No... that code was self explanatory, if you don't understand it, you don't know php well enough to be writing plugins for the public.
  6. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    What do you mean? the stuff around it should already be in your plugin unless all you want it to do is add "Tag!" below names.
  7. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    This is a Pocketmine API function, and has nothing to learning with PHP
  8. FlamingGenius
    Offline

    FlamingGenius Active Member

    Joined:
    Sep 23, 2015
    Posts:
    173
    Minecraft User:
    FlamingGenius
    I just started coding it of course ima change that just getting a rough draft
    Dude learn how to read im saying IF I HAD NO KNOWLEDGE OF THE API AND PHP obviously i do if in coding plugins ugh learn to read
  9. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Are you trying to pick a fight? If the code in the core didn't exist, the code @TheMaks posted would be useless, because there wouldn't be an "API" to run it on.
  10. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    They still have to run the command...
  11. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    can someone help :(
  12. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    But you do so....
  13. FlamingGenius
    Offline

    FlamingGenius Active Member

    Joined:
    Sep 23, 2015
    Posts:
    173
    Minecraft User:
    FlamingGenius
    Pm me i would be happy to help with whatever you need
  14. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    Please calm down, everyone here is learning and there is nothing you should be rude about o_O
    Andrey Nazarchuk likes this.
  15. FlamingGenius
    Offline

    FlamingGenius Active Member

    Joined:
    Sep 23, 2015
    Posts:
    173
    Minecraft User:
    FlamingGenius
    Okay mr.genius what happens when a newb comes on here with little to no knowledge of PHP or the API okay

    Hes not gonna understand a bit of that code because theres no explanation and no link and the newb is just gonna blindly copy the code and then @Gamecrafter is gonna get agrevated and be mean to the newb for copying something they didnt understand
  16. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    ...ok... I dont think @TheMaks is a noob though.
    Ok whatever this fight has gone on long enough, sorry and no hard feelings.
    FlamingGenius likes this.
  17. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    who said this was a fight :p:D
  18. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The thread was started to ask for the source of the function in the source code, not to ask how to use it.

    Please note that PHP is not a human. The setNameTag function is not self explanatory if that function did not exist.

    And the function does not work if you don't read its contents, because function names are often misleading. For instance, the TaskHandler->cancel() method does not cancel the task properly, but is just an internal method in PocketMine. If you don't read the source code, you will misuse it.
Thread Status:
Not open for further replies.

Share This Page

Advertisement