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

How to get players name from $args

Discussion in 'Facepalm' started by rektpixel, Oct 14, 2017.

  1. rektpixel

    rektpixel Baby Zombie

    Messages:
    186
    Hello,
    I have this code:
    PHP:
                            $this->args $args;
                            
    $name $this->args->getName;
                            
    $sender->addTitle("§eSelect a ban reason for§7", ($name), 31003);
    The error occours at:
    PHP:
    $name $this->args->getName;
    I have no idea why I get an error from this, someone please haalllppp me :/
    this is the error:
    Code:
    [17:47:47] [Server thread/CRITICAL]: Unhandled exception executing command 'banhammer rekingpixel' in banhammer: Trying to get property 'getName' of non-object
    [17:47:47] [Server thread/CRITICAL]: ErrorException: "Trying to get property 'getName' of non-object" (EXCEPTION) in "BanHammer/src/itsmemes/Main" at line 79
    [17:47:47] [Server thread/DEBUG]: #0 BanHammer/src/itsmemes/Main(79): pocketmine\error_handler(integer 8, string Trying to get property 'getName' of non-object, string C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\BanHammer\src\itsmemes\Main.php, integer 79, array Array())
    [17:47:47] [Server thread/DEBUG]: #1 src/pocketmine/command/PluginCommand(58): itsmemes\Main->onCommand(pocketmine\Player object, pocketmine\command\PluginCommand object, string banhammer, array Array())
    [17:47:47] [Server thread/DEBUG]: #2 src/pocketmine/command/SimpleCommandMap(241): pocketmine\command\PluginCommand->execute(pocketmine\Player object, string banhammer, array Array())
    [17:47:47] [Server thread/DEBUG]: #3 src/pocketmine/Server(1971): pocketmine\command\SimpleCommandMap->dispatch(pocketmine\Player object, string banhammer rekingpixel)
    [17:47:47] [Server thread/DEBUG]: #4 src/pocketmine/Player(2181): pocketmine\Server->dispatchCommand(pocketmine\Player object, string banhammer rekingpixel)
    [17:47:47] [Server thread/DEBUG]: #5 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(219): pocketmine\Player->chat(string /banhammer rekingpixel)
    [17:47:47] [Server thread/DEBUG]: #6 src/pocketmine/network/mcpe/protocol/CommandRequestPacket(47): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleCommandRequest(pocketmine\network\mcpe\protocol\CommandRequestPacket object)
    [17:47:47] [Server thread/DEBUG]: #7 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(91): pocketmine\network\mcpe\protocol\CommandRequestPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object)
    [17:47:47] [Server thread/DEBUG]: #8 src/pocketmine/network/mcpe/protocol/BatchPacket(115): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\CommandRequestPacket object)
    [17:47:47] [Server thread/DEBUG]: #9 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(91): pocketmine\network\mcpe\protocol\BatchPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object)
    [17:47:47] [Server thread/DEBUG]: #10 src/pocketmine/Player(3055): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object)
    [17:47:47] [Server thread/DEBUG]: #11 src/pocketmine/network/mcpe/RakLibInterface(143): pocketmine\Player->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object)
    [17:47:47] [Server thread/DEBUG]: #12 src/raklib/server/ServerHandler(97): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string 192.168.8.105:54014, raklib\protocol\EncapsulatedPacket object, integer 0)
    [17:47:47] [Server thread/DEBUG]: #13 src/pocketmine/network/mcpe/RakLibInterface(82): raklib\server\ServerHandler->handlePacket()
    [17:47:47] [Server thread/DEBUG]: #14 src/pocketmine/network/Network(89): pocketmine\network\mcpe\RakLibInterface->process()
    [17:47:47] [Server thread/DEBUG]: #15 src/pocketmine/Server(2501): pocketmine\network\Network->processInterfaces()
    [17:47:47] [Server thread/DEBUG]: #16 src/pocketmine/Server(2257): pocketmine\Server->tick()
    [17:47:47] [Server thread/DEBUG]: #17 src/pocketmine/Server(2136): pocketmine\Server->tickProcessor()
    [17:47:47] [Server thread/DEBUG]: #18 src/pocketmine/Server(1718): pocketmine\Server->start()
    [17:47:47] [Server thread/DEBUG]: #19 src/pocketmine/PocketMine(556): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar://C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar/, string C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\, string C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\)
    [17:47:47] [Server thread/DEBUG]: #20 C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar(1): require(string phar://C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
    
     
    Last edited: Oct 14, 2017
  2. rektpixel

    rektpixel Baby Zombie

    Messages:
    186
    Whoops *
    PHP:
    $sender->addTitle("§eSelect a ban reason for§7", ($args[0]), 31003);
    :facepalm:
     
  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.