⚙ïļuser_cmd

user_cmd datatype

Enums

Buttons
  • in_attack

  • in_attack2

  • in_jump

  • in_duck

  • in_forward

  • in_back

  • in_use

  • in_left

  • in_right

  • in_move_left

  • in_move_right

  • in_score

Functions

get_command_number

local cmd_number = user_cmd:get_command_number()

Returns:

command_number

number

get_view_angles

local view_angles = user_cmd:get_view_angles()

Returns:

pitch

number

yaw

number

set_view_angles

user_cmd:set_view_angles(0, 90, 0)

pitch

number

yaw

number

roll

number

get_move

local move = user_cmd:get_move()

Returns:

forward_move

number

side_move

number

set_move

user_cmd:set_move(450, 0)

forward_move

number

forward move value

(-450 - 450)

side_move

number

side move value (-450 - 450)

get_buttons

local buttons = user_cmd:get_buttons()

buttons

number

set_buttons

user_cmd:set_buttons(utils.flags(user_cmd:get_buttons(), csgo.in_jump, csgo.in_duck))

Extra

Get / Set specific button flags

Make sure you have bit.bset defined!

local function GetButton(cmd, button)
    return bit.band(cmd:get_buttons(), button) ~= 0
end

local function SetButton(cmd, button, value)
    cmd:set_buttons(bit.bset(cmd:get_buttons(), math.log(button, 2), tonumber(value)))
end

-- Example usage

function on_setup_move(cmd)
    -- Returns true if the in_attack flag is set to 1
    local attacking = GetButton(cmd, csgo.in_attack)
    -- Sets the in_attack flag to 1
    SetButton(cmd, csgo.in_attack, true)
end

Last updated