AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Assisted Kills - not working correctly. (https://forums.alliedmods.net/showthread.php?t=183712)

Y060N 04-25-2012 16:24

Assisted Kills - not working correctly.
 
PHP Code:

public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{    
    .....
        
    if (
isZombie[victim])
    {
        
g_iDamage[attacker][victim] += floatround(damagefloatround_floor)
    }

    .....
}

public 
event_DeathMsg()
{
    static 
KillerVictim

    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 
1<= g_iMaxPlayersp++)
        {
            if(
!= 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.


All times are GMT -4. The time now is 07:43.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.