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

teleport bug - moved wrongly!

Discussion in 'Development' started by Ozelord, Jan 4, 2017.

  1. Ozelord

    Ozelord Spider

    Messages:
    8
    Hey, i have a problem. I wrote a plugin which teleports the player back, if he jumps from something down and get fall damage. So the problem is, its not working. For a short time the player will be teleport to his old location who he jumps down, but than I get a warning in the console ("PlayerXYZ moved wrongly!") and the player will be teleport to the location, who he got fall damage. Sometimes I dont get the warning-message..
    Does anyone know why? Thanks!
     
    Goodstuff4U likes this.
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    mind showing us code?
     
  3. Ozelord

    Ozelord Spider

    Messages:
    8
    Yes, sorry:
    PHP:
    public function onDamage(EntityDamageEvent $event) {
        if (
    $event->getCause() == EntityDamageEvent::CAUSE_FALL) {
            
    $player $event->getEntity ();
            if (
    $player instanceof Player) {
                
    $player->teleport ( new Vector3 143.5109155.5 ) );
                
    $player->sendPopup TextFormat::BOLD TextFormat::RED "Du bist gestorben!" TextFormat::RESET );
            }
        }
        
    $event->setCancelled();
    }
     
    Last edited: Jan 4, 2017
    Goodstuff4U likes this.
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    how you would know that that specific vector is their last position?
     
  5. Ozelord

    Ozelord Spider

    Messages:
    8
    That doesn't matter...
     
    Goodstuff4U likes this.
  6. Deeonix

    Deeonix Spider Jockey

    Messages:
    29
    @Ozelord I suspect that it doesn't work, because the pocketmine version is not stable yet.
    I have also tried it with teleportation via Console(dispatchCommand()), setPosition() and getSafeSpawn() - The problem still the same
     
    jasonwynn10 and Ozelord like this.
  7. Ozelord

    Ozelord Spider

    Messages:
    8
    Okay thanks! :c
     
  8. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    There are a whole variety of issues related to movement and teleportation at the moment, most of them due to bad anti-cheat, ranging from death/respawn not working properly, freezes/memleaks when teleporting, getting TPed down ladders, etc.. It's probably going to need a full rewrite to remove all the crap.
     
  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.