Garry's Mod Wiki

GM:ScalePlayerDamage

boolean GM:ScalePlayerDamage( Player ply, number hitgroup, CTakeDamageInfo dmginfo )

Description

This hook allows you to change how much damage a player receives when one takes damage to a specific body part.

This is called only for bullet damage a player receives, you should use GM:EntityTakeDamage instead if you need to detect ALL damage.

Arguments

1 Player ply
The player taking damage.
2 number hitgroup
The hitgroup where the player took damage. See Enums/HITGROUP
3 CTakeDamageInfo dmginfo
The damage info.

Returns

1 boolean
Return true to prevent damage that this hook is called for, stop blood particle effects and blood decals.

It is possible to return true only on client ( This will work only in multiplayer ) to stop the effects but still take damage.

Example

Makes the player take twice as much damage when shot in the head, and only half damage when shot in the limbs.

function GM:ScalePlayerDamage( ply, hitgroup, dmginfo ) if ( hitgroup == HITGROUP_HEAD ) then dmginfo:ScaleDamage( 2 ) // More damage when we're shot in the head else dmginfo:ScaleDamage( 0.50 ) // Less damage when shot anywhere else end end

Page Links


Special Pages


Wikis

?

Render Time: 76ms

DB GetPage 45
Generate Html 10
SaveChanges (1) 12
Render Body 0
Render Sidebar 7