> ## Documentation Index
> Fetch the complete documentation index at: https://lua.wingless.one/llms.txt
> Use this file to discover all available pages before exploring further.

# Command

> The cmd object is passed to the createmove callback.

The `cmd` object is passed to the `createmove` callback.

## Methods

| Method | Returns | Description |
| - | - | - |
| `number()` | `number` | Command sequence number |
| `buttons()` | `number` | Current button bitmask |
| `set_buttons(bits)` | | Overwrite button state |
| `has(bit)` | `bool` | Check if a button is held |
| `press(bit)` | | Force a button down |
| `release(bit)` | | Force a button up |
| `move()` | `forward, left` | Movement values (-1..1) |
| `set_move(fw, left [, press])` | | Set movement. `press` auto-sets W/A/S/D buttons |
| `view_angles()` | `vector` | Current view angles |
| `set_view_angles(angles)` | | Silent aim (server only) |
| `lock_angles()` | | Prevent further angle changes this tick |
| `rotate_movement(yaw [, press])` | | Rotate movement to match a yaw. `press` sets buttons |

## Button constants

```lua theme={null}
buttons.attack
buttons.jump
buttons.duck
buttons.forward
buttons.back
buttons.use
buttons.left
buttons.right
buttons.attack2
buttons.reload
buttons.speed
```

Also available as `button.*` in game command context:

```lua theme={null}
button.IN_ATTACK
button.IN_JUMP
button.IN_DUCK
button.IN_FORWARD
button.IN_BACK
button.IN_USE
button.IN_MOVELEFT
button.IN_MOVERIGHT
button.IN_ATTACK2
button.IN_RELOAD
button.IN_SPEED
button.IN_WALK
button.IN_SCORE
```

## Example

```lua theme={null}
events.on('createmove', function(cmd)
    -- auto jump
    if cmd:has(buttons.jump) and not entity.local_pawn():on_ground() then
        cmd:release(buttons.jump)
    end
end)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.