Gamemode.HandlePlayerDucking

From GMod Wiki

Revision as of 14:24, 7 November 2010 by Cube334 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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