Garry's Mod Wiki

GM:GetFallDamage

  number GM:GetFallDamage( Player ply, number speed )

Description

Called when a player takes damage from falling, allows to override the damage.

Arguments

1 Player ply
The player
2 number speed
The fall speed

Returns

1 number
New fall damage

Example

The player takes a realistic amount of damage when they fall. Fall damage becomes the fall speed divided by 8.

hook.Add( "GetFallDamage", "RealisticDamage", function( ply, speed ) return ( speed / 8 ) end )

Example

Closely approximates the Counter-Strike: Source fall damage.

hook.Add( "GetFallDamage", "CSSFallDamage", function( ply, speed ) return math.max( 0, math.ceil( 0.2418 * speed - 141.75 ) ) end )