CTakeDamageInfo.IsDamageType

From GMod Wiki

Revision as of 18:43, 26 February 2011 by nüke (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax CTakeDamageInfo:IsDamageType( Integer DamageType )
Description:
Returns true if the damage type equals the one in the given argument.
Returns: Boolean
In Object: CTakeDamageInfo
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=CTakeDamageInfo.IsDamageType]CTakeDamageInfo.IsDamageType [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionThis messages to the console when damage from poison is taken.
Used onNewerServer.png
Code
function GM:ScalePlayerDamage( ply, hitgroup, dmginfo )
   if dmginfo:IsDamageType( DMG_POISON ) then
      MsgN( "Player "..ply:Name().." took "..dmginfo:GetDamage().." poison damage." )
   end
end
OutputN/A


Additional Notes

Here is a list of available enumerations:

SHARED | 0000000000000000 | 0000000000000000000000000000000 | DMG_GENERIC -- Generic damage.
SHARED | 0000000000000001 | 0000000000000000000000000000001 | DMG_CRUSH -- Damage from props.
SHARED | 0000000000000002 | 0000000000000000000000000000010 | DMG_BULLET -- Damage from bullets.
SHARED | 0000000000000004 | 0000000000000000000000000000100 | DMG_SLASH -- Damage from most melee attacks (that scratch, lacerate, or cut).
SHARED | 0000000000000008 | 0000000000000000000000000001000 | DMG_BURN -- Burn damage (e.g. Igniting something and noclipping in it).
SHARED | 0000000000000016 | 0000000000000000000000000010000 | DMG_VEHICLE
SHARED | 0000000000000032 | 0000000000000000000000000100000 | DMG_FALL -- Damage from high falls.
SHARED | 0000000000000064 | 0000000000000000000000001000000 | DMG_BLAST -- Damage from explosives (ear-ringing effect).
SHARED | 0000000000000128 | 0000000000000000000000010000000 | DMG_CLUB -- Damage from some enemy melee attacks (blunt or unarmed) e.g. Combine melee attack.
SHARED | 0000000000000256 | 0000000000000000000000100000000 | DMG_SHOCK -- Damage from electricity (creates sparks and puff of smoke at damage position).
SHARED | 0000000000000512 | 0000000000000000000001000000000 | DMG_SONIC -- Damage from supersonic objects (unused).
SHARED | 0000000000001024 | 0000000000000000000010000000000 | DMG_ENERGYBEAM -- Damage from energy beams (unused).
SHARED | 0000000000002048 | 0000000000000000000100000000000 | DMG_PREVENT_PHYSICS_FORCE
SHARED | 0000000000004096 | 0000000000000000001000000000000 | DMG_NEVERGIB
SHARED | 0000000000008192 | 0000000000000000010000000000000 | DMG_ALWAYSGIB
SHARED | 0000000000016384 | 0000000000000000100000000000000 | DMG_DROWN -- Drowning damage.
SHARED | 0000000000032768 | 0000000000000001000000000000000 | DMG_PARALYZE -- Damage from paralyzing.
SHARED | 0000000000065536 | 0000000000000010000000000000000 | DMG_NERVEGAS -- Damage from nervegas. (GLaDOS's gas from the ending of Portal)
SHARED | 0000000000131072 | 0000000000000100000000000000000 | DMG_POISON -- Damage from poison (e.g. black headcrabs).
SHARED | 0000000000262144 | 0000000000001000000000000000000 | DMG_RADIATION -- Damage from radiation (Geiger counter will also go off).
SHARED | 0000000000524288 | 0000000000010000000000000000000 | DMG_DROWNRECOVER -- ? (unused) Perhaps health regained after surfacing.
SHARED | 0000000001048576 | 0000000000100000000000000000000 | DMG_ACID -- Damage from dangerous acids. (gives a light-cyan flash ingame)
SHARED | 0000000002097152 | 0000000001000000000000000000000 | DMG_SLOWBURN
SHARED | 0000000004194304 | 0000000010000000000000000000000 | DMG_REMOVENORAGDOLL
SHARED | 0000000008388608 | 0000000100000000000000000000000 | DMG_PHYSGUN -- Damage from the Gravity Gun (e.g. pushing headcrabs).
SHARED | 0000000016777216 | 0000001000000000000000000000000 | DMG_PLASMA -- Turns the player's screen dark and plays sounds until the player's next footstep.
SHARED | 0000000033554432 | 0000010000000000000000000000000 | DMG_AIRBOAT -- Damage from airboat gun.
SHARED | 0000000067108864 | 0000100000000000000000000000000 | DMG_DISSOLVE -- Damage from combine stuff like combine balls and the core.
SHARED | 0000000134217728 | 0001000000000000000000000000000 | DMG_BLAST_SURFACE 
SHARED | 0000000268435456 | 0010000000000000000000000000000 | DMG_DIRECT -- Damage from being on fire.(DMG_BURN relates to external sources hurting you)
SHARED | 0000000536870912 | 0100000000000000000000000000000 | DMG_BUCKSHOT -- Damage from shotguns. (basically the same as DMG_BULLET)

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox