On_PlayerKilled

Feb 8, 2015
On_PlayerKilled
  • Method:
    On_PlayerKilled

    Argument(s):
    HurtEvent he

    Examples:
    Python:
    Code (Python):
    def On_PlayerKilled(self, DeathEvent):
        attacker = DeathEvent.Attacker.Name
        victim = DeathEvent.Victim.Name
        weapon = DeathEvent.Weapon.Name
        Server.BroadcastFrom("DEATHMSG", attacker + " killed " + victim + " with " + weapon)
     

    Javascript:
    Code (Javascript):
    function On_PlayerKilled(DeathEvent) {
        var attacker = DeathEvent.Attacker.Name;
        var victim = DeathEvent.Victim.Name;
        var weapon = DeathEvent.WeaponName;
        Server.BroadcastFrom("DEATHMSG", attacker + " killed " + victim + " with " + weapon);
    }
    C#:
    Code (C#):

    public override void Initialize()
    {
         Hooks.OnPlayerKilled += PlayerKilled;
    }

    public override void DeInitialize()
    {
         Hooks.OnPlayerKilled -= PlayerKilled;
    }

    public void PlayerKilled(DeathEvent de)
    {
         Player attacker = (Player) de.Attacker;
         Player victim = (Player) de.Victim;
         string weapon = de.WeaponName;
         Server.GetServer().Broadcast(attacker.Name + " killed " + victim.Name + " with " + weapon);
    }