🎮cuser_cmd

Describes a user command.

command_number

FieldRead only

Type: int

Current command number.


get_button

Method

Returns state of the specified button.

Arguments

1. Button

Name

Type

Description

button

Button.

Returns

Type

Description

bool

Is pressed.

Example

if cmd:get_button(input_bit_mask.in_use) then
    -- ...
end

set_button

Method

Sets the specified button into the command.

Arguments

1. Button

Name

Type

Description

button

Button.

Example

cmd:set_button(input_bit_mask.in_use)

remove_button

Method

Removes the specified button from the command.

Arguments

1. Button

Name

Type

Description

button

Button.

Example

cmd:remove_button(input_bit_mask.in_attack)

get_viewangles

Method

Returns the current viewangles of the command.

Arguments

None.

Returns

Type

Description

Viewangles.

Example

local ang = cmd:get_viewangles();

set_viewangles

Method

Sets the specified angles into the command.

Arguments

1. Angles

Name

Type

Description

angles

Angles.

Example

cmd:set_viewangles(target_angles)

lock_angles

Method

Sets the command viewangles into the games view.

Arguments

None.

Example

cmd:set_viewangles(target_angles)
cmd:lock_angles()

get_forwardmove

Method

Returns the forwardmove of the command. (0.0 - 1.0)

Arguments

None.

Returns

Type

Description

float

forwardmove.

Example

local fmove = cmd:get_forwardmove();

get_leftmove

Method

Returns the leftmove of the command. (0.0 - 1.0)

Arguments

None.

Returns

Type

Description

float

leftmove.

Example

local lmove = cmd:get_leftmove();

set_forwardmove

Method

Sets the specified forwardmove into the command. (0.0 - 1.0)

Arguments

Type

Description

float

forwardmove.

Example

cmd:set_forwardmove(1.0);

set_leftmove

Method

Sets the specified leftmove into the command. (0.0 - 1.0)

Arguments

Type

Description

float

leftmove.

Example

cmd:set_leftmove(1.0);

rotate_movement

Method

Rotates the commands movement toward the specified yaw without affecting viewangles.

Arguments

Type

Description

float

yaw.

Example

cmd:set_leftmove(0.0);
cmd:set_forwardmove(1.0);
cmd:rotate_movement(target_yaw);

Last updated