How I can tp a player to a position when he click a sign? Also I want tp players to different position. I was thinking in: PHP: $lplayers = count($this->getServer()->getLevelByName("mapname")->getPlayers());if ($lplayers == "0"){$player->teleport(#location)}elseif ($lplayers == "1"){$player->teleport(#location)} ...
By looking at his code it would seem taptodo wouldnt work if he is trying to teleport a player to different locations based on how many players are in a level
I need specify if it's a sign? Like PHP: public function OnClickSign(onPlayerInteractEvent $event){$player = $event->getPlayer();if($event->getBlock()->getID() == Item::SIGN){$player->teleport(#location)}}
If you want to check if the block is a sign do it like this: PHP: $block = $event->getBlock();$blockID = $block->getId();if($blockID === 323 or $blockID === 63 or $blockID === 68) { // block is a sign} else { // block is no sign}
Can it be used to give players, items, as I am currently thinking of using it as a parkour rewarding system
Try this: PHP: public function onSignTap(PlayerInteractEvent $event) { if($event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68) { $sign = $event->getPlayer()->getLevel()->getTile($event->getBlock()); $player = $event->getPlayer(); if(!($sign instanceof Sign)) { return; } $sign = $sign->getText(); if($sign[0] == "[Text-First-Line]") {# Execute some }}
Please learn PHP before trying to answer a question incorrectly: http://php.net/manual/en/language.operators.comparison.php
I've already told him this(in a previous post), you don't have to repeat it. Please stop trying so desperately to increase your post count. You're just repeating what @iksaku said in a previous post. Please don't do this(repeating the same post), as this can be considered "spam".