Hello, An if is not fonctional in this code : PHP: $cdn = $this->arenas[$level][1]; //arrayif($cdn == 0){ //here$block = $lvl->getBlockIdAt($player->x, $player->y-0.1, $player->z);if($block == 355){if($this->getTeam($player) == "blue"){}elseif($this->getTeam($player) == "red"){}foreach($lvl->getPlayers() as $pl){if($this->getTeam($pl) == "blue"){$pl->teleport(new Position($config->get("spawnX-Blue"),$config->get("spawnY-Blue"),$config->get("spawnZ-Blue"),$this->getServer()->getLevelByName($config->get("Level"))));}if($this->getTeam($pl) == "red"){$pl->teleport(new Position($config->get("spawnX-Red"),$config->get("spawnY-Red"),$config->get("spawnZ-Red"),$this->getServer()->getLevelByName($config->get("Level"))));}}$this->resetArena($arena = $level);}} Help me please Thank you in advance !
There is no way for us to determine the problem. Share any errors/output you might get, and explain what you expected to happen and what actually happened.
The point is what you expect to happen. The code looks perfectly valid to us, doing what the code should do. But that may not be what you expect to happen
Not necessarily. There is no context for the code. The whole thing may be inside a loop or switch function for all we know. Debug your plugin. Make sure you understand what conditional statements aren't returning like you expect it to.
I added a bunch of var_dump statements for you. Maybe you can answer the questions I left in the comments too? PHP: $cdn = $this->arenas[$level][1]; //arrayvar_dump($cdn); //var_dump here to make sure $cdn is integerif($cdn == 0){ //here $block = $lvl->getBlockIdAt($player->x, $player->y-0.1, $player->z); var_dump($block); if($block == 355){ if($this->getTeam($player) == "blue"){ echo "blue"; //echo here for debug }elseif($this->getTeam($player) == "red"){ echo "red";//echo here for debug } foreach($lvl->getPlayers() as $pl){ if($this->getTeam($pl) == "blue"){ // is this CaSe sensitive? $pl->teleport(new Position($config->get("spawnX-Blue"),$config->get("spawnY-Blue"),$config->get("spawnZ-Blue"),$this->getServer()->getLevelByName($config->get("Level")))); // why are there no defaults? } if($this->getTeam($pl) == "red"){ // is this CaSe sensitive? $pl->teleport(new Position($config->get("spawnX-Red"),$config->get("spawnY-Red"),$config->get("spawnZ-Red"),$this->getServer()->getLevelByName($config->get("Level")))); // why are there no defaults? } } $this->resetArena($arena = $level); // is $level defined?}