View Single Post
lightphoenix2
Member
Join Date: Feb 2016
Old 01-29-2021 , 08:22   Re: [L4D2] Setting Damage dealt to witch
Reply With Quote #11

Code:
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
{
	if(GetEntityClassname(victim, "witch", 10) && attacker > 0 && GetClientTeam(attacker) == 2 && g_iLevel[attacker] > 0 && attacker <= MaxClients && victim > MaxClients)
	{
		damage = GetRandomFloat(criMulMin, criMulMAX) * damage + 1;
		Knockback(attacker, victim, CritForce, 1.5, 2.0);
		if (CritPrint)
		{
			PrintToChat(attacker, "\x01Critical!\x03 %.2f\x01 damage", damage);
		}
		return Plugin_Changed;
	}
	if (attacker > 0 && attacker <= MaxClients && GetClientTeam(attacker) == 2 && g_iLevel[attacker] > 0)
	{
		if (GetClientTeam(victim) == 2)
		{
			return Plugin_Continue;
		}
		damage = GetRandomFloat(criMulMin, criMulMAX) * damage + 1;
		if (CritPrint)
		{
			PrintToChat(attacker, "\x01Critical!\x03 %.2f\x01 damage", damage);
		}
		
		Knockback(attacker, victim, CritForce, 1.5, 2.0);
		return Plugin_Changed;
	}
	return Plugin_Continue;
}
GetEntityClassname(victim, "witch", 10) also works for any special infected, I don't know why.
I need another if statement on top to make the plugin work, I also don't know why.

Last edited by lightphoenix2; 01-29-2021 at 08:23.
lightphoenix2 is offline