1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Player who shot bow

Discussion in 'Development' started by iCirgio, May 27, 2019.

  1. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    Yeah so I'm trying to trace the player who shot the arrow that hit another player

    Short terms;
    How do I find the player that shot another player
     
    Clik likes this.
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Handle EntityDamageByChildEntityEvent...
    Check if $event->getChild() is an instance of Arrow projectile. $event->getDamager() is the entity which shot the bow.

    There are a few cases where a player hit by a bow won't trigger EntityDamageByChildEntityEvent. If the shooter shoots the bow, shooter quits server, arrow hits the entity, that event won't be triggered because server can't fetch an instance of the shooter. In this case EntityDamageByEntityEvent would be triggered where $event->getDamager() is the Arrow projectile.
     
    Clik and OnTheVerge like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.