Aim, attack and keys
Acting through approved scripts.
keys
Press the keys CS2 binds to game commands (+jump, slot3, ...). Only in an approved version of the file.
Everything here needs Allow scripts to aim, shoot and press keys in Scripts > Security (off by default).
keys.press(cmd [, ms]) -> boolean, stringPresses the key CS2 binds to a game command ("+jump", "slot3", ...) for ms, clamped 10..200; refused "unbound" when CS2 binds no key to the command. Same rules as input.press.
| Name | Type | Default | Description |
|---|---|---|---|
cmd | string | ||
msoptional | number | 30 |
boolean, string
events.on("tick", function() keys.press("+jump", 30) end)keys.tap(cmd [, ms]) -> boolean, stringAlias of keys.press.
| Name | Type | Default | Description |
|---|---|---|---|
cmd | string | ||
msoptional | number | 30 |
boolean, string
events.on("tick", function() keys.tap("+jump", 30) end)keys.down(cmd) -> boolean, stringHolds a game command's key on a 2 s lease, like input.down.
| Name | Type | Description |
|---|---|---|
cmd | string |
boolean, string
events.on("tick", function() keys.down("+jump") end)keys.up(cmd) -> boolean, stringReleases this state's hold of a game command's key. Accepted also while actions are blocked (menu open, panic, ...): a release is never refused for the gate.
| Name | Type | Description |
|---|---|---|
cmd | string |
boolean, string
events.on("tick", function() keys.up("+jump") end)keys.release(cmd) -> boolean, stringAlias of keys.up.
| Name | Type | Description |
|---|---|---|
cmd | string |
boolean, string
events.on("tick", function() keys.release("+jump") end)keys.hold(cmd, ms) -> boolean, stringHolds a game command's key for ms, clamped 1..2000, like input.hold.
| Name | Type | Description |
|---|---|---|
cmd | string | |
ms | number |
boolean, string
events.on("tick", function() keys.hold("+jump", 30) end)keys.release_all() -> boolean, stringReleases everything this state holds: its keys, its queued or held attack and its aim lease. Accepted also while actions are blocked (menu open, panic, ...): a release is never refused for the gate.
boolean, string
events.on("tick", function() keys.release_all() end)keys.reload() -> boolean, stringPresses +reload for 30 ms.
boolean, string
events.on("tick", function() keys.reload() end)keys.inspect() -> boolean, stringPresses +lookatweapon for 30 ms.
boolean, string
events.on("tick", function() keys.inspect() end)keys.use() -> boolean, stringPresses +use for 30 ms.
boolean, string
events.on("tick", function() keys.use() end)keys.drop() -> boolean, stringPresses drop for 30 ms.
boolean, string
events.on("tick", function() keys.drop() end)keys.jump() -> boolean, stringPresses +jump for 30 ms. Called again while the key is still down it extends the hold instead of jumping again.
boolean, string
events.on("tick", function() keys.jump() end)keys.duck([ms]) -> boolean, stringHolds +duck for ms, clamped 1..2000. The 30 ms default is a tap: pass a longer time, or call it every tick, to stay crouched.
| Name | Type | Default | Description |
|---|---|---|---|
msoptional | number | 30 |
boolean, string
events.on("tick", function() keys.duck() end)keys.walk([ms]) -> boolean, stringHolds +sprint (CS2 walk) for ms, clamped 1..2000. The 30 ms default is a tap: pass a longer time, or call it every tick, to keep walking.
| Name | Type | Default | Description |
|---|---|---|---|
msoptional | number | 30 |
boolean, string
events.on("tick", function() keys.walk() end)keys.slot(n) -> boolean, stringPresses slot1..slot10.
| Name | Type | Description |
|---|---|---|
n | integer |
boolean, string
events.on("tick", function() keys.slot(3) end)keys.lastinv() -> boolean, stringPresses lastinv.
boolean, string
events.on("tick", function() keys.lastinv() end)keys.next_weapon() -> boolean, stringPresses invnext; a wheel-only binding gets one wheel notch.
boolean, string
events.on("tick", function() keys.next_weapon() end)keys.prev_weapon() -> boolean, stringPresses invprev; a wheel-only binding gets one wheel notch.
boolean, string
events.on("tick", function() keys.prev_weapon() end)Everything here needs Allow scripts to aim, shoot and press keys in Scripts > Security (off by default).
aim.look_at(pos [, opts]) -> boolean, stringAsks native aim to turn the view smoothly toward a world point (a vec3, or x, y, z). opts: fov (degrees from the crosshair, default 10, capped by Script aim max FOV); aim_time_ms (default 40, clamped between Minimum aim time and 2000; the weapon's Aim profile time wins when longer, and its reaction delay, curve, noise and overshoot apply); player (a Player index: then that player must be alive and not spawn-protected, and the aim leads its movement); hitgroup (0..10, a tag only: the aim point stays the position); mode = "assist" (default: yields while native aim has its own target) or "override" (needs Scripts may replace the Aim target). The request is a 60 ms lease: repeat it every tick or combat event. true means accepted, not moved: nothing moves while the point is outside fov, the held item is not a firearm or is reloading or empty, the weapon's Aim profile is off or blocks (in air, flashed, smoke), an overlay attack press is held, or (assist) native aim has a target. Script aim turns at most 900 deg/s, timed on the real frame time, so the speed is the same at any fps; the first frame of a new script aim only starts its clock and does not move. When the user moves the mouse the lease ends and aim requests are refused "hand" for 200 ms.
| Name | Type | Description |
|---|---|---|
pos | vec3 | |
optsoptional | table |
boolean, string
events.on("tick", function() aim.look_at(vec3(100, 200, 64), {fov=5}) end)aim.turn(d_pitch, d_yaw [, opts]) -> boolean, stringLike aim.look_at, toward the current view turned by d_pitch, d_yaw degrees (+d_pitch looks down, +d_yaw turns left; pitch stops at 89). The turn is from the view at each call, so repeating aim.turn(0, 2) keeps the target moving as one continuous motion. opts: fov (degrees from the crosshair, default 10, capped by Script aim max FOV); aim_time_ms (default 40, clamped between Minimum aim time and 2000; the weapon's Aim profile time wins when longer, and its reaction delay, curve, noise and overshoot apply); player (a Player index: then that player must be alive and not spawn-protected, and the aim leads its movement); hitgroup (0..10, a tag only: the aim point stays the position); mode = "assist" (default: yields while native aim has its own target) or "override" (needs Scripts may replace the Aim target). The request is a 60 ms lease: repeat it every tick or combat event. true means accepted, not moved: nothing moves while the point is outside fov, the held item is not a firearm or is reloading or empty, the weapon's Aim profile is off or blocks (in air, flashed, smoke), an overlay attack press is held, or (assist) native aim has a target. Script aim turns at most 900 deg/s, timed on the real frame time, so the speed is the same at any fps; the first frame of a new script aim only starts its clock and does not move. When the user moves the mouse the lease ends and aim requests are refused "hand" for 200 ms.
| Name | Type | Description |
|---|---|---|
d_pitch | number | |
d_yaw | number | |
optsoptional | table |
boolean, string
events.on("tick", function() aim.turn(0, 2) end)aim.release() -> boolean, stringEnds this state's aim lease. Accepted also while actions are blocked (menu open, panic, ...): a release is never refused for the gate.
boolean, string
events.on("tick", function() aim.release() end)attack
Primary and secondary attack presses through the trigger safety gates. Only in an approved version of the file.
Everything here needs Allow scripts to aim, shoot and press keys in Scripts > Security (off by default).
attack.fire([opts]) -> boolean, stringQueues one primary press. opts: hold_ms (default 30, 1..200), delay_ms (default 0, 0..1000). Hold and delay are raised to the humanize.script profile's draw. Primary attacks are refused "combat" unless the held weapon has ammo, is not reloading and its Triggerbot profile is enabled with its no-air, no-flash and smoke conditions met; any attack is refused "native" while a native trigger or the nade helper is attacking, "physical" while the user holds the button, "busy" while an attack is queued or held, "rate" past 8 attacks per second. A queued press not sent within 250 ms of its time is dropped; a held one is released as soon as a condition fails.
| Name | Type | Description |
|---|---|---|
optsoptional | table |
boolean, string
events.on("tick", function() attack.fire({hold_ms=30}) end)attack.hold(ms) -> boolean, stringOne primary press held ms, clamped 1..200, like attack.fire({hold_ms = ms}). Hold and delay are raised to the humanize.script profile's draw. Primary attacks are refused "combat" unless the held weapon has ammo, is not reloading and its Triggerbot profile is enabled with its no-air, no-flash and smoke conditions met; any attack is refused "native" while a native trigger or the nade helper is attacking, "physical" while the user holds the button, "busy" while an attack is queued or held, "rate" past 8 attacks per second. A queued press not sent within 250 ms of its time is dropped; a held one is released as soon as a condition fails.
| Name | Type | Description |
|---|---|---|
ms | number |
boolean, string
events.on("tick", function() attack.hold(50) end)attack.secondary([ms]) -> boolean, stringOne secondary press held ms, clamped 1..200. The rules of attack.fire apply except the weapon and Triggerbot profile conditions.
| Name | Type | Default | Description |
|---|---|---|---|
msoptional | number | 30 |
boolean, string
events.on("tick", function() attack.secondary(30) end)attack.release() -> boolean, stringReleases this state's queued or held attack. Accepted also while actions are blocked (menu open, panic, ...): a release is never refused for the gate.
boolean, string
events.on("tick", function() attack.release() end)Everything here needs Allow scripts to aim, shoot and press keys in Scripts > Security (off by default).
act.status() -> tableThis state's action status: {allowed, panic, reason, aim_live, attack_live, accepted, refused, held = {vk, ...}, rate = {edges_last_second, presses_last_second}, leases = {aim, attack}}. allowed: it may act now; reason: why not (live while blocked: menu, chat, focus, ...), else its last refusal or why its holds were dropped ("" after an accepted call); accepted / refused: its call counts; held: the keys it holds; edges_last_second: its key presses, releases and wheel notches in the last second (limit 20); presses_last_second: its attack presses in the last second (limit 8; key presses are not counted); leases.aim / leases.attack: the same as aim_live / attack_live. Its keys, attack and aim lease are dropped when one of its callbacks raises an error ("error"), runs past its own time cap (2 ms, 0.5 ms for combat) or uses at least half of the frame budget itself before the budget stops it ("budget"); a callback stopped only because other scripts used the budget keeps them. Every action call returns true, "" or false and one of these reasons: permission (act off), unsafe (insecure FFI allowed), not running, approval, panic, menu (overlay menu or an overlay text field), local player (none, or dead); input disabled (Allow input is off), focus (CS2 is not the foreground window), cursor (CS2 shows a cursor: console, buy menu or another game menu), chat (CS2 chat is open), gate (the overlay has not read a game frame yet); unbound (CS2 binds no key to the command); binding (mouse3..mouse5 or the wheel not bound); key (a key scripts may never press); chord; physical (the user holds the key); native (an overlay feature uses it); owner (another script holds it); duration; rate; hand (the mouse moved in the last 200 ms); override; target; combat; busy (an attack is already queued or held); command; slot; position; mode; override disabled; unavailable; and in act.status only, after the runtime dropped this state's holds: budget (one of its callbacks overran), error (one of its callbacks raised an error). The act, aim, attack and keys tables and input.press / down / up / hold / release_all exist only when the script declares act and this exact source version is approved: test act ~= nil. Deny in Action approvals is saved: that version is not offered again, also after a restart, until the file changes. Allowing insecure FFI stops a running action script. Script panic (Stop script actions on the Scripts page) releases everything and refuses "panic" until reset; the app panic key latches it too, but only while that key also unloads (set, and no other bind uses it).
table
local status = act.status()