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

Distance

Discussion in 'Development' started by Jonas, May 4, 2017.

Thread Status:
Not open for further replies.
  1. Jonas

    Jonas Baby Zombie

    Messages:
    192
    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();
    }
     
  2. Intyre

    Intyre Administrator Staff Member PMMP Team

    Messages:
    81
    GitHub:
    Intyre
  3. Jonas

    Jonas Baby Zombie

    Messages:
    192
    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();
            }
         }
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    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)
     
  5. Jonas

    Jonas Baby Zombie

    Messages:
    192
    I want to check the time when the player move with the distance Example: 7 Blocks in 6 Seconds = kick etc.
     
  6. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    you will need a task to block it, a task on every 20 ticks to revert motion
     
  7. Jonas

    Jonas Baby Zombie

    Messages:
    192
    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
     
  8. Intyre

    Intyre Administrator Staff Member PMMP Team

    Messages:
    81
    GitHub:
    Intyre
    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!
     
    HimbeersaftLP and Thouv like this.
  9. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    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!
     
Thread Status:
Not open for further replies.
  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.