From 5a3e059a42c4429013c67a55339a7a7d4bb250cc Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 23 Jan 2011 19:39:19 +0100 Subject: [PATCH] include push-deaths in the weapon stats too --- qcsrc/server/cl_player.qc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 9570f6ab5..f1d290a9b 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -537,23 +537,28 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht else self.pushltime = 0; - float abot, vbot; + float abot, vbot, awep; abot = (clienttype(attacker) == CLIENTTYPE_BOT); vbot = (clienttype(self) == CLIENTTYPE_BOT); valid_damage_for_weaponstats = 0; if(vbot || clienttype(self) == CLIENTTYPE_REAL) if(abot || clienttype(attacker) == CLIENTTYPE_REAL) - if(self != attacker) - if(!DEATH_ISSPECIAL(deathtype)) + if(attacker && self != attacker) if(IsDifferentTeam(self, attacker)) + { + if(DEATH_ISSPECIAL(deathtype)) + awep = attacker.weapon; + else + awep = DEATH_WEAPONOF(deathtype); valid_damage_for_weaponstats = 1; + } if(valid_damage_for_weaponstats) { dh = dh - max(self.health, 0); da = da - max(self.armorvalue, 0); - WeaponStats_LogDamage(DEATH_WEAPONOF(deathtype), abot, self.weapon, vbot, dh + da); + WeaponStats_LogDamage(awep, abot, self.weapon, vbot, dh + da); } if (self.health < 1) @@ -568,7 +573,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht } if(valid_damage_for_weaponstats) - WeaponStats_LogKill(DEATH_WEAPONOF(deathtype), abot, self.weapon, vbot); + WeaponStats_LogKill(awep, abot, self.weapon, vbot); if(sv_gentle < 1) // TODO make a "gentle" version? if(sound_allowed(MSG_BROADCAST, attacker)) -- 2.39.2