CTakeDamageInfo.GetAttacker

From GMod Wiki

(Redirected from DamageInfo.GetAttacker)
Jump to: navigation, search
Function
Syntax CTakeDamageInfo:GetAttacker( )
Description:
Returns the object of the attacker entity.
Returns: Entity attacker
In Object: CTakeDamageInfo
Available On:
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=CTakeDamageInfo.GetAttacker]CTakeDamageInfo.GetAttacker [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionThis informs players when they hit stuff.
Used on
Code
function GM:ScalePlayerDamage(ply,hitgroup,dmginfo)
   if dmginfo:GetAttacker():IsPlayer() then
      dmginfo:GetAttacker():PrintMessage (3, "You hit "..ply:Name().." for "..dmginfo:GetDamage().." damage!\n")
   end
end
OutputNone.
Personal tools