Gamemode.CreateMove

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameCreateMove
SyntaxGM:CreateMove( CUserCmd cmd )
DescriptionAllows you to change the players movements before they're sent to the server.
ReturnsNil
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.CreateMove]Gamemode.CreateMove [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionRandomly sets a player's view Pitch, Roll and Yaw (Very crazy)
Used onNewerClient.png
Code
function CrazyViews( cmd )
    cmd:SetViewAngles(Angle(math.random(-179,180),math.random(-179,180),math.random(-179,180)))
end
hook.Add("CreateMove", "CrazyViews", CrazyViews)
 
OutputN/A
DescriptionDisable jumping for a player (on the client only - set the player's jump power to 0 on the server to make this foolproof)
Used onNewerClient.png
Code
function NoJump( cmd )
    if cmd:GetButtons() & IN_JUMP > 0 then
       cmd:SetButtons( cmd:GetButtons() - IN_JUMP )
    end
end
hook.Add("CreateMove", "NoJumping", NoJump)
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox