CTakeDamageInfo.GetAmmoType

From GMod Wiki

Jump to: navigation, search
Function
Syntax CTakeDamageInfo:GetAmmoType( )
Description:
Returns the ammo type which caused the damage, or -1 if the damage was not caused with ammo.
Returns: Integer ammo type
In Object: CTakeDamageInfo
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=CTakeDamageInfo.GetAmmoType]CTakeDamageInfo.GetAmmoType [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis messages to the console what type of bullet damaged the player.
Used onNewerServer.png
Code
function GM:EntityTakeDamage( ent, inflictor, attacker, amount, dmginfo ) 
  if ent:IsPlayer() then
   Msg("Player was hit by bullet #"..dmginfo:GetAmmoType())
  end
end
OutputN/A

Additional Notes

List of bullets' ids:

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox