Garry's Mod Wiki

GM:PlayerHurt

  GM:PlayerHurt( Player victim, Entity attacker, number healthRemaining, number damageTaken )

Description

Called when a player gets hurt.

Arguments

1 Player victim
Victim
2 Entity attacker
Attacker Entity
3 number healthRemaining
Remaining Health
4 number damageTaken
Damage Taken

Example

Show players attacker in Chat.

function GM:PlayerHurt(victim, attacker) if ( attacker:IsPlayer() ) then victim:ChatPrint("You were attacked by : " .. attacker:Nick()) end end