Skip to content

user_cmd_t

function on_setup_command(cmd) 
    print(cmd.tick_count)
    print(cmd.viewangles)
end

callbacks.add(e_callbacks.SETUP_COMMAND, on_setup_command)

Fields#

Field Description
command_number
int
[read-only]
tick_count
int
[read-only] the tick this client was created
viewangles
angle_t
aim_direction
vec3_t
move
vec3_t
movement direction (x = forwardmove, y = sidemove, z = upmove)
impulse
int
weaponselect
int
entity index of weapon to switch to
weaponsubtype
int
random_seed
int
mousedx
int
mousedy
int
hasbeenpredicted
int
[read-only]
head_angles
angle_t
head_offset
vec3_t

Functions#

has_button#

checks if a cmd button is pressed

bool has_button(<e_cmd_buttons> cmd_button)

Fields Description
cmd_button
e_cmd_buttons

Example

local shooting = cmd:has_button(e_cmd_buttons.ATTACK)

add_button#

add a cmd button

void add_button(<e_cmd_buttons> cmd_button)

Fields Description
cmd_button
e_cmd_buttons

Example

cmd:add_button(e_cmd_buttons.ATTACK) // force shooting

remove_button#

removes a cmd button

void remove_button(<e_cmd_buttons> cmd_button)

Fields Description
cmd_button
e_cmd_buttons

Example

cmd:remove_button(e_cmd_buttons.ATTACK) // prevent shooting

clear_buttons#

removes all cmd buttons

void clear_buttons()

Example

cmd:clear_buttons() -- goobye