Actually I'm wrong here, TF_CUSTOM_HEADSHOT isn't a flag for damage, it's a flag for kills.
A working plugin would look something like this:
HTML Code:
public void OnPluginStart()
{
// for lateloading
for (int i = 1; i <= MaxClients; i++)
{
if (!IsValidClient(i))
{
continue;
}
OnClientPutInServer(i);
}
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_TraceAttack, OnTraceAttack);
}
public Action OnTraceAttack(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
{
// headbox
if (hitgroup == 1)
{
// always headshot if we hit the head
damagetype |= (DMG_USE_HITLOCATIONS | DMG_CRIT);
return Plugin_Changed;
}
return Plugin_Continue;
}
__________________