CUserCmd.SetButtons

From GMod Wiki

Jump to: navigation, search
Function
Syntax CUserCmd:SetButtons( Integer IN_KEYS )
Description:
Sets the IN_KEYS in the user command to the specified integer representing which of them are held down.
Returns: nil
In Object: CUserCmd
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=CUserCmd.SetButtons]CUserCmd.SetButtons [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionMakes you move forward all the time as if you were holding down your forward movement key.
Used onNewerClient.png
Code
local function MakeMeMoveForwardAllTheTime( ply, cmd )
 
    cmd:SetButtons( cmd:GetButtons() | IN_FORWARD )
 
end
hook.Add( "CreateMove", "MakeMeMoveForwardAllTheTimeExample", MakeMeMoveForwardAllTheTime )
 
OutputYou will always be moving forward.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox