GM:GetFallDamage

From Garry's Mod
Jump to: navigation, search
 GM:GetFallDamage( )

Contents

Description

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

Arguments

Player ply

The player

Arguments

number speed

The fall speed

Returns

number

New fall damage

Examples

Example

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

function GM:GetFallDamage( ply, speed )
    return ( speed / 8 )
end


Examples

Example

Closely approximates the Counter-Strike: Source fall damage.

function GM:GetFallDamage( ply, speed )
	return math.max( 0, math.ceil( 0.2418*speed - 141.75 ) )
end


Personal tools
Navigation