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

Solved How To Get Player Username PocketMine PMMP

Discussion in 'Plugin Help' started by ALLINSEO, Mar 17, 2017.

  1. ALLINSEO

    ALLINSEO Baby Zombie

    Messages:
    133
    hello I am currently using a plugin thats a little outdated but it still works I was trying to add some features to it for private use but I am struggling a little bit.

    CODE.php

    Code:
    
        public function onTap(PlayerInteractEvent $tap){
    
    
                            $PlayerName = $tap->getPlayer();
         $cmd2 = $block->getText()[2] . $PlayerName . $block->getText()[3];
    
    }
    
    
    Issue;
    I am trying to make
    $PlayerName = $tap->getPlayer();
    $cmd2 = $block->getText()[2] . $PlayerName . $block->getText()[3];

    Generate the username instead of inputting "player(1)"
     
    Last edited: Mar 18, 2017
  2. AnkitM252

    AnkitM252 Spider Jockey

    Messages:
    29
    GitHub:
    AnkitM252
    You forgot getName() ! Use this:
    PHP:
    $PlayerName $tap->getPlayer()->getName();
     
    Matrox likes 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.