Here you go thats how to properly do it....
PHP Code:
#define IsPlayer(%1) (1 <= %1 <= MAX_PLAYERS)
enum DAMAGE_PARAMS
{
Float:DAMAGE_AMOUNT,
Float:DAMAGE_TIME
}
new g_aDamageData[MAX_PLAYERS+1][MAX_PLAYERS+1][DAMAGE_PARAMS]
public @PlayerTakeDamage_Post( __int_Victim, __int_Inflictor, __int_Attacker, Float:__float_Damage, __int_DamageBits )
{
if(IsPlayer(__int_Attacker))
{
g_aDamageData[__int_Victim][__int_Attacker][DAMAGE_AMOUNT] += __float_Damage;
g_aDamageData[__int_Victim][__int_Attacker][DAMAGE_TIME] = get_gametime();
}
static i, players[32], pnum, player;
get_players(players, pnum);
for(i = 0; i < pnum; i++)
{
player = players[ i ];
if ( g_aDamageData[player][__int_Victim][DAMAGE_TIME] > 0.0 && floatabs(g_aDamageData[__int_Victim][player][DAMAGE_TIME] - g_aDamageData[player][__int_Victim][DAMAGE_TIME]) <= 1.0 )
{
PlayersExchangeAttacks(__int_Victim, player, g_aDamageData[__int_Victim][player][DAMAGE_AMOUNT], g_aDamageData[player][__int_Victim][DAMAGE_AMOUNT]);
}
}
}
PlayersExchangeAttacks(iPlayerOne, iPlayerTwo, Float:fDealtDamage_PlayerOne, Float:fDealtDamage_PlayerTwo)
{
// Make sure to reset players time fire exchange to prevent calling it for them multiple times...
g_aDamageData[iPlayerOne][iPlayerTwo][DAMAGE_TIME] = 0.0;
g_aDamageData[iPlayerTwo][iPlayerOne][DAMAGE_TIME] = 0.0;
// Both players attacked each other in less than 1 second...
}
__________________