How can i check the distance in the playermoveevent? I have only write this PHP: public function onMove(PlayerMoveEvent $e){ $from = $event->getFrom(); $to = $event->getTo();}
You can get a ton of examples from the source code. https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Player.php#L1559 https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/math/Vector3.php#L176-L182 There is also a search function on GitHub. https://github.com/pmmp/PocketMine-MP/search?utf8=✓&q=distance&type=
Thanks i have made it but i don t work. Here is my Code: PHP: public function onSpeed(PlayerMoveEvent $event) { $player = $event->getPlayer(); $from = $event->getFrom(); $to = $event->getTo(); $time = microtime(true); $distance = $from->distance($to); if($distance <= 11 && $time <= 11){ $player->kick(); } }
microtime(true) returns the number of seconds that have elapsed since 1970-1-1 00:00:00 UTC. I don't know what you want to do with $time <= 11, but it will definitely always be much much greater than 11. (The microtime right now is 1493988588.1357)
I want to check the time when the player move with the distance Example: 7 Blocks in 6 Seconds = kick etc.
Sry i dont can make a task. Pls give me not the Link to the resource Forum to create a Task. Can you give me an example how can i make this
Don't ask for examples if you don't want to read how to use a task from the Resource section. Anyway, you're going offtopic. Therefore I will close this thread!
It's actually fine if you don't want to make a task. Just send a message to your admin to ask him to run a command 11 seconds later. Easy!