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

Murders...

Comments in 'Plugin Development' started by SuperChipsLP, Jan 29, 2014.

  1. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Hey Guys!

    How can i get the murder of a player by using the player.death handler?
    I know it's $data["cause"]; , but this gives me an entity. How can i get the player object, so i can do things like:

    $murder =
    PHP:
    $murder->sendChat("Why did you kill a player?");
    `

    or

    PHP:
    $murder->setHealth(0);

    I have taken this

    PHP:
    if(is_numeric($data["cause"])){
                        
    $e $this->api->entity->get($data["cause"]);
                        if(
    $e instanceof Entity){
                            switch(
    $e->class){
                                case 
    ENTITY_PLAYER:
                                 
                                 
                                    break;
                            }
                        }

                    }
    from the PlayerAPI, but it doesn't work.

    Thanks.
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    PHP:
    $murder $this->api->player->getByEID($data['cause']);
    PEMapModder and SuperChipsLP like this.
  3. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Thanks. That works. :)

Share This Page

Advertisement