Skip to content

Class: UserCmd

Class to work with the current command being sent to the server.

Fields

integer: command_number

integer: tick_count

EulerAngles: viewangles

Vector3: aimdirection

number: forwardmove

number: sidemove

number: upmove

integer: buttons

integer: impulse

integer: weaponselect

integer: weaponsubtype

integer: random_seed

integer: mousedx

integer: mousedy

boolean: hasbeenpredicted

EulerAngles: headangles

Vector3: headoffset

boolean: sendpacket

Functions

EulerAngles GetViewAngles() Returns the viewangles.

SetViewAngles(angles:EulerAngles) Set the viewangles.

SetSendPacket(value:boolean) Set the value of sendpacket.

SetButtons(buttons:integer) Set the buttons.

Warning

When setting a button make sure to GetButtons() first and add any additional button using the bitwise operator OR.

Note

Read more about Bitwise Operators.

Note

Check the Valve SDK regarding the value of buttons

integer GetButtons() Returns the buttons.

SetForwardMove(float:number) Set the forwardmove value.

GetForwardMove() Return the amount of forward move.

SetSideMove(float:number) Move to the side, accepts float value.

GetSideMove() Return the amount of side move.

SetUpMove(float:number) Move up, accepts float value.

GetUpMove() Return the amount of up move.

boolean GetSendPacket() Return the sendpacket value.

SetSendPacket(value:boolean) Set the sendpacket value.

Example

-- Add IN_ATTACK button to the current buttons.
cmd.buttons = cmd.buttons | (1 << 0)