If you glanced at the link I posted you would be able to see that Valve code would have done all of the heavy lifting for you.
Even if you aren't that adept at reading C++ code, you can decipher that:
- It's a TraceAttack function
- CanFireCriticalShot is only fired if both the hitgroup == 1 (HITGROUP_HEAD) and damagetype & DMG_USE_HITLOCATIONS
- If all of that stuff is true, it would both add the DMG_CRIT to the damagetype and set the custom to TF_CUSTOM_HEADSHOT
So in the end, you
will need to use a TraceAttack hook and set the update the damagetype as you have it already.
__________________