Assisted Kills - not working correctly.
PHP Code:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) { ..... if (isZombie[victim]) { g_iDamage[attacker][victim] += floatround(damage, floatround_floor) }
..... }
public event_DeathMsg() { static Killer, Victim
Killer = read_data(1) Victim = read_data(2) new iKiller1 = Killer new iKiller2 = 0 new iKillerTemp = 0 new iDamage2 = 0 if(Killer != Victim && isZombie[Victim]) { for(new p = 1; p <= g_iMaxPlayers; p++) { if(p != Killer && is_user_connected(p) && (g_iDamage[p][Victim] > iDamage2) && (g_iDamage[p][Victim] >= 700)) { if ( g_iDamage[p][Victim] > g_iDamage[iKiller1][Victim]) { iKillerTemp = iKiller1 iKiller1 = p iKiller2 = iKillerTemp iDamage2 = g_iDamage[p][Victim] } else if ((g_iDamage[p][Victim] > g_iDamage[iKiller2][Victim]) && (g_iDamage[p][Victim] >= 700)) { iKiller2 = p iDamage2 = g_iDamage[p][Victim] } } g_iDamage[p][Victim] = 0 } } }
So I have this (there is code that I left out in the takedamage and deathmsg, but later in death msg it gives XP to the killer1 and if there is a killer2, then killer2). But when someone kills a zombie that is low HP - maybe someone else did 1800 damage and the zombie has 200hp left, the person that does 200 damage gets the kill and the person that did 1800 damage gets nothing.
I am not sure why this is happening. It should check against everyone that did damage to the zombie and see from there whether the person that did 200 damage is eligible - and he shouldn't be.
|