Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Entity Died with lava ?

Comments in 'Plugin Development' started by Ritch, Mar 29, 2016.

  1. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    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();

                    }
                    }
                    }
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    What is your problem? So far all you've done is posted code. You havent said what you need help with.
    PEMapModder and Skullex like this.
  3. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    My problem is as i died the message not appears Need help ?
  4. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    cause can't be instance of entitydamageevent, due to lave is no entity remove that line
  5. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    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
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Mind formatting your code better next time? It is really hard to read with the poor indentation like this.
  7. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    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
    Ritch likes this.
  8. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    what ???? problem
  9. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    No one told him to code it on the forums. Thats what an IDE and copy and paste is for.
    Nawaf_Craft1b and PEMapModder like this.
  10. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    Can you tell me $this->players isarray ! Or not
    Omar2s2 and PEMapModder like this.
  11. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    What ??
  12. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    "-_-
    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;} } }}
    Ritch and PEMapModder like this.
  13. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    Do you have eror In Your Console !
    Omar2s2 likes this.
  14. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    nice syntax.
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    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?
    Last edited: Mar 30, 2016
  16. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    No xD ! I not have error of my log.
  17. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    • You are died lava !
    • You are won !
    Seriously?
    PEMapModder likes this.
  18. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    1) stop spamm
    2) you dont help me.
  19. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    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.
  20. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    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 .

Share This Page

Advertisement