PHP: public function onPlayerDeathLava(PlayerDeathEvent $event){ $player = $event->getEntity(); $causeId = $player->getLastDamageCause()->getCause(); $cause = $player->getLastDamageCause(); $lvl = $player->getLevel()->getName(); if($lvl === "test"){ if(isset($this->players[$player->getName()])){ unset($this->players[$player->getName()]); switch($causeId){ case EntityDamageEvent::CAUSE_LAVA: if($cause instanceof EntityDamageByEntityEvent){ $player->sendMessage(TextFormat::RED."[GAME] you are died lava !"); $this->getServer()->loadLevel("world"); $this->refreshSign(); if(count($this->players) <= 1){ foreach($this->players as $pl){ $pl->sendMessage("you are won !"); $pl->teleport($this->getServer()->getLevelByName("world")->getSafeSpawn()); $pl->setNameTag($pl->getName()); $pl->getInventory()->clearAll(); } } }
What is your problem? So far all you've done is posted code. You havent said what you need help with.
PHP: public function onPlayerDeathLava(PlayerDeathEvent $event){ $player = $event->getEntity(); $causeId = $player->getLastDamageCause()->getCause(); $cause = $player->getLastDamageCause(); $lvl = $player->getLevel()->getName(); if($lvl === "test"){ if(isset($this->players[$player->getName()])){ unset($this->players[$player->getName()]); switch($causeId){ case EntityDamageEvent::CAUSE_LAVA: $player->sendMessage(TextFormat::RED."[GAME] you are died lava !"); $this->getServer()->loadLevel("world"); $this->refreshSign(); if(count($this->players) <= 1){ foreach($this->players as $pl){ $pl->sendMessage("you are won !"); $pl->teleport($this->getServer()->getLevelByName("world")->getSafeSpawn()); $pl->setNameTag($pl->getName()); $pl->getInventory()->clearAll(); } } @Ritch
Mind formatting your code better next time? It is really hard to read with the poor indentation like this.
It's really hard to make an indentation with the PHP tags of this forum, because you can'T use TAB in this forum I'j goo robue.d
"-_- PHP: public function onPlayerDeathLava(PlayerDeathEvent $event){$player = $event->getEntity();$causeId = $player->getLastDamageCause()->getCause();$lvl = $player->getLevel()->getName();if ($lvl === "test") {if (isset($this->players[$player->getName()])) {unset($this->players[$player->getName()]);switch ($causeId) {case EntityDamageEvent::CAUSE_LAVA:$player->sendMessage(TextFormat::RED . "[GAME] you are died lava !");$this->getServer()->loadLevel("world");$this->refreshSign();if (count($this->players) <= 1) {foreach ($this->players as $pl) {$pl->sendMessage("you are won !");$pl->teleport($this->getServer()->getLevelByName("world")->getSafeSpawn());$pl->setNameTag($pl->getName());$pl->getInventory()->clearAll();} }break;} } }}
Did the wires in your keyboard between '?' and '!' get mixed up? I suppose he just copied the code, so he doesn't even know that $this->players is an array at all?
Report me in that case! You never learn, it's worthless to try. It's easy to copy code and even more easier to say it doesn't work.
And 3) [Solved] 4) stop posting post with not code You are a big n*** please arrested for posting of useless thing to make your intessent when you're a big shit .