Gamemode.HandlePlayerSwimming

From GMod Wiki

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

Examples

DescriptionHandles animations for swimming
Used onNewerShared.png
Code
 
function GM:HandlePlayerSwimming( ply )
 
    if ply:WaterLevel() >= 2 then
        if ply.m_bFirstSwimFrame then
            ply:AnimRestartMainSequence()
            ply.m_bFirstSwimFrame = false
        end
 
        ply.m_bInSwim = true
    else
        ply.m_bInSwim = false
        if !ply.m_bFirstSwimFrame then
            ply.m_bFirstSwimFrame = true
        end
    end
 
    return false
end
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox