I'm trying to make some var changes when players shoot teammates. I'm running another plugin which blocks damage (prevention of friendly fire). Is it safe to hook OnTakeDamage and use it in another plugin? I'm not trying to change/block damage in this second one, just want to set some global vars.
The reason i'm asking is because - witch damage to players is being blocked somehow, and sometimes the hook stops firing for specific clients after a while. I can't use l4d2 player_hurt event for what i'm trying to do, because it doesnt activate with my friendly protection plugin.
There could be some problem with the plugin some other way of course, but here is the way i'm using it, does it look safe? Thanks!
Code:
int MyVar[MAXPLAYERS+1];
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakePlayerDamage);
}
public Action OnTakePlayerDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
{
if(IsClientInGame(attacker) && IsClientInGame(victim) && attacker != victim)
{
if(!IsFakeClient(attacker) && !IsFakeClient(victim))
{
if(GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2)
{
MyVar[attacker] = 1;
}
}
}
}