Garry's Mod Wiki

Revision Difference

GM:OnDamagedByExplosion#563747

<function name="OnDamagedByExplosion" parent="GM" type="hook"> <description>Called when a player has been hurt by an explosion. Override to disable default sound effect.</description> <realm>Server</realm> <args> <arg name="ply" type="Player">Player who has been hurt</arg> <arg name="dmginfo" type="CTakeDamageInfo">Damage info from explosion</arg> </args> </function> <example> <description> Disables the high pitched ringing sound effect. Note that this hook does not have a return value, and instead by default it calls <page>Player:SetDSP</page>( 35, false ) in the base gamemode. Note that this hook does not have a return value, and instead by default it calls <page>Player:SetDSP</page>`( 35, false )` in the base gamemode. ⤶ This example uses a built-in feature of the hook system to prevent the default gamemode action. See more info on the <page>hook.Add</page> page.⤶ </description> <code> hook.Add( "OnDamagedByExplosion", "DisableSound", function() return true end ) </code> </example>