View Single Post
alexip121093
Senior Member
Join Date: Dec 2009
Location: Hong Kong
Old 02-01-2011 , 00:59   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#1104

Quote:
Originally Posted by darkjohn20 View Post
I had a question about OnTraceAttack. I'm trying to modify damage if the attacker and victim are on the same team, but when a grenade is the cause of damage, the teams are always different. How can I get the grenade's owner's team in OnTraceAttack?

PHP Code:
public Action:OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotypehitboxhitgroup){
     new 
bool:IsTeammate IsTeammate(victimattacker);

     if(
VIsTeam){ //Doesn't work for Grenades.
         
damage *= 0.5;
     }
}
bool:IsTeammate(victimattacker){
     new 
bool:PlayerIsTeammate = (GetClientTeam(victim) == GetClientTeam(attacker));
     return 
PlayerIsTeammate;

You should use OnTakeDamage
__________________
alexip121093 is offline
Send a message via MSN to alexip121093