I want to recognise if something isn’t a head shot in something I am coding. Player:LastHitGroup() has no documentation on the Wiki and I couldn’t find any sight of it on code.garrysmod.com either.
This is in GM:DoPlayerDeath();
[lua]local LastHitGroup = Player:LastHitGroup();
print( "Hit group: ", LastHitGroup );
if( LastHitGroup != HITGROUP_HEAD ) then
print( “Hi” );
Hit group: 0 Hi
No matter where I kill my test subject (a bot) either on the torso or the head the result is always the same.
Thanks in advance.
I managed to solve it. Will post it for any future people who find LastHitGroup() to be useless:
function GM:ScalePlayerDamage( Player, HitGroup, DamageInfo )
if( HitGroup == HITGROUP_HEAD ) then
Player.ReceivedHeadShot = true;
Player.ReceivedHeadShot = false;
And I then check that boolean in GM:DoPlayerDeath() when I want to see if they died from a head shot or not.