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

Undefinded offfset: 1

Discussion in 'Plugin Help' started by ZackyVN, Dec 31, 2018.

  1. ZackyVN

    ZackyVN Baby Zombie

    Messages:
    150
    So i have this code
    PHP:
     public function onQuit(PlayerQuitEvent $e) {
      
    $player $e->getPlayer();
      
    $task $this->tasks[$player->getId()];
      unset(
    $this->tasks[$player->getId()]);
      
    $task->getHandler()->cancel();
     }
    }
    When i started server, it sent this error
    Code:
    2018-12-31 [02:17:43] [Server thread/INFO]: MrDinoDuck joined the game
    2018-12-31 [02:19:35] [Server thread/CRITICAL]: ErrorException: "Undefined offset: 1" (EXCEPTION) in "Wings-1/src/Wings/Main" at line 160
    2018-12-31 [02:20:22] [Server thread/CRITICAL]: ErrorException: "Undefined offset: 2" (EXCEPTION) in "Wings-1/src/Wings/Main" at line 160
    
    It make me cant join the server
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    That code you posted should only be executed when the player exits the game, and since your error happens when a player joins, it makes sense that your code snippet isn't related to the problem. Do you have an event handler for players joining, and if so, can we see that?

    If you are decent at troubleshooting and research, you may be able to resolve this yourself. Your problem isn't a pocketmine-related issue, it's a php error. Thankfully, it's common enough that there are plenty of explanations on why it occurs and how to fix it. This should help.
     
    wolfdale likes this.
  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.