View Single Post
Author Message
mapper07
Member
Join Date: Oct 2012
Location: NY
Old 03-07-2014 , 22:36   [Solved]Friendlyfire Between Two Players
Reply With Quote #1

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 attackerFloat:damage, const iDamageType)
{
    if(
g_bKnifeDuel)
    {
        if( 
get_bit(Challengerattacker) && !get_bit(Challengeevictim )
        || 
get_bit(Challengeeattacker) && !get_bit(Challengervictim )
        || 
get_bit(Challengervictim) && !get_bit(Challengeeattacker )
        || 
get_bit(Challengeevictim) && !get_bit(Challengerattacker ) )
        {
            
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(victimg_iVictimTeam == TEAM_T TEAM_CT TEAM_T);
            
EnableHamForward(g_iHhTakeDamagePost);
            return 
HAM_HANDLED;
        }    
    }

    return 
HAM_IGNORED;


Last edited by mapper07; 03-10-2014 at 21:24. Reason: Solved thanks to Hornet and Compidence
mapper07 is offline