Quote:
Originally Posted by Spirit_12
|
Like this?
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
// #include <smlib>
public OnPluginStart()
{
HookEvent("infected_hurt", WitchHurt_Event, EventHookMode_Post);
}
public WitchHurt_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
// new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new victimEntId = GetEventInt(event, "entityid");
new hitgroup = GetEventInt(event, "hitgroup"); //headshot is 1
if (IsWitch(victimEntId) && hitgroup == 1)
{
PrintToChatAll("Witch headshot registered");
//set damage amount to
// SDKHooks_TakeDamage(victimEntId, attacker, attacker, 300.0, DMG_BULLET, -1, NULL_VECTOR, NULL_VECTOR);
// Entity_Hurt(victimEntId, 300, attacker);
SetEventInt(event, "amount", 300);
}
}
stock bool:IsWitch(iEntity)
{
if(iEntity > 0 && IsValidEntity(iEntity) && IsValidEdict(iEntity))
{
decl String:strClassName[64];
GetEdictClassname(iEntity, strClassName, sizeof(strClassName));
return StrEqual(strClassName, "witch");
}
return false;
}
It doesn't seems to be working, even though headshot still registers.