I have been using the following code to deny headshots to humans.
How would i modify this to reduce damage taken?
What I would like to do is deny all headshots and reduce all other damage to humans by half.
Code:
// ---------------------------------------------------------------------------------------
// TraceLine()
//
// Disallow headshot damange to human players
// ---------------------------------------------------------------------------------------
void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)
{
TRACE_LINE(v1, v2, fNoMonsters, pentToSkip, ptr);
if ( ((1<<HITGROUP_HEAD) & (1<<ptr->iHitgroup)) &&
!(ptr->pHit->v.flags & FL_FAKECLIENT) )
{
// return no damage
ptr->flFraction = 1.0;
RETURN_META(MRES_SUPERCEDE);
}
else
{
RETURN_META(MRES_IGNORED);
}
}