Code:
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
{
char classname[6];
if(GetEntityClassname(victim, classname, sizeof(classname)) && StrEqual(classname, "witch") && attacker > 0 && GetClientTeam(attacker) == 2 && g_iLevel[attacker] > 0 && attacker <= MaxClients)
{
damage = GetRandomFloat(criMulMin, criMulMAX) * damage + 1;
Knockback(attacker, victim, CritForce, 1.5, 2.0);
if (CritPrint)
{
PrintToChat(attacker, "1\x01Critical!\x03 %.2f\x01 damage", damage);
}
return Plugin_Changed;
}
if (attacker > 0 && attacker <= MaxClients && GetClientTeam(attacker) == 2 && g_iLevel[attacker] > 0 && GetClientTeam(victim) != 2)
{
damage = GetRandomFloat(criMulMin, criMulMAX) * damage + 1;
Knockback(attacker, victim, CritForce, 1.5, 2.0);
if (CritPrint)
{
PrintToChat(attacker, "2\x01Critical!\x03 %.2f\x01 damage", damage);
}
return Plugin_Changed;
}
return Plugin_Continue;
}
This is the final version, from what API says, there is this String Buffer, I just need to save it and compare it as you did. GetEntityClassname function itself returns a boolean, but it can also store the classname in the second parameter, I didn't notice it until you mention it to me about the return function.
I have a theory why it can't detect witch without detecting its class, since Marttt mention witch is not SI and more like common infected. It will automatically skip or stop the Plugin. I tested beforehand, and when witch takes damage it will trigger OnTakeDamage, but it just stop, it never even reach