Hi , i' m new on the forum and that is my first thread if something is not written correctly is because i' m not english I need an help with that : PHP: public function isGameFull($levelName){ if($this->config->get("MaxPlayersPerGame") == count($this->getServer()->getLevelByName($levelName)->getPlayers())){ return true; }else{ return false; } } when that function is called the server crash, reason: call to a member function getPlayers() on NULL why ? I would appreciate if someone reply ,thanks to all
You can also just use PHP: return $maxPlayers === $otherMax;// You have to replace/define them instead of if/else.
you' re right but the error is the same... PHP: public function isGameFull($levelName){ return $this->config->get("MaxPlayersPerGame") === count($this->getServer()->getLevelByName($levelName)->getPlayers()); } ...Call to a member function getPlayers() on null
I tried to enter the level name string : PHP: public function isGameFull($levelName){ return $this->config->get("MaxPlayersPerGame") === count($this->getServer()->getLevelByName("lobby")->getPlayers()); } nothing change ... the level folder is in her place and is called "lobby"... i really don' t know why this error appears
1. Make sure $levelName is "lobby". 2. Make sure the world is loaded. 3. Make sure the world name not just the world folder name is lobby.