GM:OnPlayerHitGround

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

Contents

Description

Called when a player makes contact with the ground.

NOTE This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.

Arguments

Entity player

Player

Arguments

boolean inWater

Did the player land in water?

Arguments

boolean onFloater

Did the player land on an object floating in the water?

Arguments

number speed

The speed at which the player hit the ground

Returns

boolean

Return true to suppress default action

Examples

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


Personal tools
Navigation