Erro: http://prnt.sc/e18xc4 Código: Caso "ir": $ Player = $ sender-> getPlayer (); $ Target = $ this-> getServer () -> getPlayer ($ args [0]); - Linha 223 If (! Isset ($ args [0])) { $ Sender-> sendMessage ("§aUse / ir <jogador>"); } $ Player-> teletransporte ($ target); $ Player-> sendMessage ("§Teleporte concluído!"); $ Target-> sendTip ("§aO ajudante". $ Sender-> getName (). "Veio para você. \ N \ n \ n \ n \ n"); pausa;
PHP: Caso "ir": $ Player = $ sender-> getPlayer (); $ Target = $ this-> getServer () -> getPlayer ($ args [0]); - Linha 223 If (! Isset ($ args [0])) { $ Sender-> sendChat ("§aUse / ir <jogador>"); } $ Player-> teletransporte ($ target); $ Player-> sendMessage ("§Teleporte concluído!"); $ Target-> sendTip ("§aO ajudante". $ Sender-> getName (). "Veio para você. \ N \ n \ n \ n \ n"); pausa; I cant understand what your saying
You're trying to get the player of $sender... $sender is already a player. Just entirely remove that line and change $Player to $sender.
Urgh, I just got spacing cancer. Also please use code blocks: [PHP]Put php code here[/PHP] OR for code, that's not php: [CODE]Your non-php code here[/CODE]
You should learn at least the basics of English. I doubt how much could you do in today's world without English. PHP stands for something that's in English. PHP's built in functions use English words. Isn't it supposed to be "case" instead of "Caso"? Anyways, fix: PHP: $Player = $sender->getPlayer();if (!isset($args[0])) {$Sender->sendMessage("§aUse / ir <jogador>");return;}$Target = $this->getServer()->getPlayer($args[0]);$Player->teletransporte($target);$Player->sendMessage("§Teleporte concluído!");$Target->sendTip("§aO ajudante". $Sender->getName(). "Veio para você. \ N \ n \ n \ n \ n");
My code in netbeans is right, and "case" in netbeans is "case" don't "caso", but when I put it in the forum, my browser translates automatically. Sorry for this.
No problem. One more thing, assuming you are a beginner to PHP... PHP $variables are not case sensitive (that is: $Variable is not the same as $variable).
Funny you should mention that... https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Player.php#L290
@DanielYTK your problem lies in trying to get the player with $args[0]. You check if $args[0] is set AFTER you execute code with it, while you should FIRST check if $args[0] is set.