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

Knockback issue

Discussion in 'Development' started by SomeServerOwner, May 13, 2021.

  1. SomeServerOwner

    SomeServerOwner Spider Jockey

    Messages:
    40
    Instead of only the combo warp having altered kb, all of the warps have kb lower than the default kb. What is the issue with the code?

    <?php


    namespace RRdescry\VaserPractice\Managers\ArenaManager\Modules\FFA;

    use pocketmine\event\entity\EntityDamageByEntityEvent;
    use pocketmine\event\entity\EntityDamageEvent;
    use pocketmine\event\Listener;
    use pocketmine\math\Vector3;
    use pocketmine\Player;
    use RRdescry\VaserPractice\Main;

    class FFAListener implements Listener
    {
    public function onAttackEntity(EntityDamageEvent $event): void {
    $entity = $event->getEntity();
    if($entity instanceof Player){
    if(Main::$instance->playerManager->players[$entity->getName()]["InArena"][0] == true){
    $arena = Main::$instance->playerManager->players[$entity->getName()]["InArena"][0];
    if($arena instanceof FFAArena && $arena->name == "Combo"){
    if($event instanceof EntityDamageByEntityEvent){
    if($entity->distance(new Vector3($entity->getFloorX(), $entity->getFloorY(), $entity->getFloorZ())) < 5){
    $event->setKnockBack($event->getKnockBack() * 1);
    }else{
    $event->setKnockBack(0.4);
    }
    }
    }
    }
    }
    }
    }
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Have a check for the world, not whatever
    PHP:
    $arena Main::$instance->playerManager->players[$entity->getName()]["InArena"][0];
    if(
    $arena instanceof FFAArena && $arena->name == "Combo"){
    this is, because whatever it's supposed to do, clearly it's not working.
     
  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.