Garry's Mod Wiki

GM:OnPlayerHitGround

  boolean GM:OnPlayerHitGround( Entity player, boolean inWater, boolean onFloater, number speed )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.

Description

Called when a player makes contact with the ground after a jump or a fall.

Arguments

1 Entity player
Player
2 boolean inWater
Did the player land in water?
3 boolean onFloater
Did the player land on an object floating in the water?
4 number speed
The speed at which the player hit the ground

Returns

1 boolean
Return true to suppress default action

Example

Explode players when they hit the ground too hard.

hook.Add( "OnPlayerHitGround", "ExplosiveFall", function( ply, inWater, onFloater, speed ) if speed > 1000 and not inWater then local exp = ents.Create( "env_explosion" ) exp:SetPos( ply:GetPos() ) exp:Spawn() exp:SetKeyValue( "iMagnitude", "0" ) exp:Fire( "Explode", 0, 0 ) ply:Kill() end end )