A class used to store the player inputs, such as mouse movement, view angles, Enums/IN buttons pressed and analog movement, the data from this class is then transfered to a CMoveData during actual movement simulation.
Removes all keys from the command. If you are looking to affect player movement, you may need to use CUserCmd:ClearMovement instead of clearing the buttons.
Clears the movement from the command. See also CUserCmd:SetForwardMove, CUserCmd:SetSideMove and CUserCmd:SetUpMove.
Returns an increasing number representing the index of the user cmd. The value returned is occasionally 0 inside GM:CreateMove and GM:StartCommand. It is advised to check for a non-zero value if you wish to get the correct number.
The speed the client wishes to move forward with, negative if the clients wants to move backwards.
Returns the delta of the angular horizontal mouse movement of the player.
The speed the client wishes to move sideways with, positive if it wants to move right, negative if it wants to move left.
The speed the client wishes to move up with, negative if the clients wants to move down.
When players are not sending usercommands to the server (often due to lag), their last usercommand will be executed multiple times as a backup. This function returns true if that is happening. This will never return true clientside.
CUserCmd:SelectWeapon( Weapon weapon )
Forces the associated player to select a weapon. This is used internally in the default HL2 weapon selection HUD. This may not work immediately if the current command is in prediction. Use input.SelectWeapon to switch the weapon from the client when the next available command can do so. This is the ideal function to use to create a custom weapon selection HUD, as it allows prediction to run properly for WEAPON:Deploy and GM:PlayerSwitchWeapon
CUserCmd:SetButtons( number buttons )
Sets the buttons as a bitflag. See also CUserCmd:GetButtons. If you are looking to affect player movement, you may need to use CUserCmd:SetForwardMove instead of setting the keys.
CUserCmd:SetForwardMove( number speed )
Sets speed the client wishes to move forward with, negative if the clients wants to move backwards. See also CUserCmd:ClearMovement, CUserCmd:SetSideMove and CUserCmd:SetUpMove.
CUserCmd:SetImpulse( number speed )
Sets the impulse command to be sent to the server. Here are a few examples of impulse numbers: 100 toggles their flashlight 101 gives the player all Half-Life 2 weapons with sv_cheats set to 1 200 toggles holstering / restoring the current weapon When holstered, the EF_NODRAW flag is set on the active weapon.
CUserCmd:SetMouseX( number speed )
Sets the delta of the angular horizontal mouse movement of the player. See also CUserCmd:SetMouseY.
CUserCmd:SetMouseY( number speed )
Sets the delta of the angular vertical mouse movement of the player. See also CUserCmd:SetMouseX.
CUserCmd:SetSideMove( number speed )
Sets speed the client wishes to move sidewards with, positive to move right, negative to move left. See also CUserCmd:SetForwardMove and CUserCmd:SetUpMove.
CUserCmd:SetUpMove( number speed )
Sets speed the client wishes to move upwards with, negative to move down. See also CUserCmd:SetSideMove and CUserCmd:SetForwardMove.
CUserCmd:SetViewAngles( Angle viewAngle )
Sets the direction the client wants to move in. The pitch (vertical) angle should be clamped to +/- 89° to prevent the player's view from glitching.
Returns tick count since joining the server. This will always return 0 for bots.Returns 0 clientside during prediction calls. If you are trying to use CUserCmd:Set*() on the client in a movement or command hook, keep doing so till TickCount returns a non-zero number to maintain prediction.