Gamemode.HandlePlayerDucking

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameHandlePlayerDucking
SyntaxGM:HandlePlayerDucking( Player ply )
DescriptionAnimation
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.HandlePlayerDucking]Gamemode.HandlePlayerDucking [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]

Examples

DescriptionHandles animitions for ducking
Used onNewerShared.png
Code
 
 
function GM:HandlePlayerDucking( ply, velocity )
 
    if ply:Crouching() then
        local len2d = velocity:Length2D()
 
        if len2d > 0.5 then
            ply.CalcIdeal = ACT_MP_CROUCHWALK
        else
            ply.CalcIdeal = ACT_MP_CROUCH_IDLE
        end
 
        return true
    end
 
    return false
end
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox