Alright so I realized my post had more information than needed. Basically, I am trying to allow friendly fire on between two players on the same team and only for those two players. I set a bit on one player as challenger and the other as challengee but I can't get it to work properly? I feel like I am making it harder than it really is.
PHP Code:
plugin_init()
{
RegisterHam(Ham_TakeDamage, "player", "Fwd_PlayerDamage", 0);
}
public Fwd_PlayerDamage(const victim, const inflictor, const attacker, Float:damage, const iDamageType)
{
if(g_bKnifeDuel)
{
if( get_bit(Challenger, attacker) && !get_bit(Challengee, victim )
|| get_bit(Challengee, attacker) && !get_bit(Challenger, victim )
|| get_bit(Challenger, victim) && !get_bit(Challengee, attacker )
|| get_bit(Challengee, victim) && !get_bit(Challenger, attacker ) )
{
SetHamReturnInteger(0);
return HAM_SUPERCEDE;
}
g_iVictimTeam = cs_get_user_team_index(victim);
if( g_iVictimTeam == cs_get_user_team_index(attacker) )
{
cs_set_user_team_index(victim, g_iVictimTeam == TEAM_T ? TEAM_CT : TEAM_T);
EnableHamForward(g_iHhTakeDamagePost);
return HAM_HANDLED;
}
}
return HAM_IGNORED;
}