View Single Post
sapphonie
Junior Member
Join Date: Aug 2020
Location: ohio
Old 10-07-2021 , 01:08   Re: [TF2] Make every weapon headshot
Reply With Quote #7

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;
}
__________________
she/her
sapphonie is offline