user_cmd_t
Read-only snapshot of the user command passed to the createmove callback.
Read-only copy of the command passed to createmove. It may be retained after the callback. Assigning any field raises; modifying returned copies does not change the real command.
| Member | Type | Description |
|---|---|---|
cmd.command_number | integer | Command number. |
cmd.tick | integer | Client tick. |
cmd.buttons | uint64_t | Held buttons; new cdata on every read. |
cmd.buttons_changed | uint64_t | Buttons whose state changed. |
cmd.buttons_scroll | uint64_t | Scroll bits. |
cmd.forwardmove, cmd.upmove | number | Movement values. |
cmd.sidemove | number | Positive means left: the engine's leftmove. |
cmd.view_angles | angle | Copy; (0, 0, 0) if absent. |
cmd.weaponselect | integer | Weapon selection. |
cmd:has_button(mask)Returns true if any masked bit is set in buttons. A press and release within a single command reads as false.
No button constants are defined. Build masks with bit.lshift(1ULL, n); attack is 1ULL and jump is 2ULL.
| Bit | Button |
|---|---|
| 0 | Attack |
| 1 | Jump |
| 2 | Duck |
| 3 | Forward |
| 4 | Back |
| 5 | Use |
| 7 | Turn left |
| 8 | Turn right |
| 9 | Move left |
| 10 | Move right |
| 11 | Attack2 |
| 13 | Reload |
| 16 | Speed / walk |
| 32 | Use or reload |
| 33 | Score |
| 34 | Zoom |
| 35 | Look at weapon |
