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.

function GM:OnPlayerHitGround( ply, inWater, onFloater, speed ) if speed > 1000 && !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

Page Links


Special Pages


Wikis

?

Render Time: 49ms

DB GetPage 3
Generate Html 14
SaveChanges (1) 18
Render Body 0
Render Sidebar 12