Callbacks & Events
Callbacks hook into CS:GOโs tick execution, render loops, and engine events.
Adding & Removing Callbacks
Section titled โAdding & Removing Callbacksโ-- Hook an eventclient.add_callback(event_name, callback_fn)
-- Remove a specific hooklocal removed = client.remove_callback(event_name, callback_fn)- Invalid event names output an error and do nothing.
- Multiple callbacks on the same event run in registration order.
client.remove_callbackreturnstrueif removed,falseotherwise.
Available Callbacks
Section titled โAvailable Callbacksโ| Event | Arguments | Timing & Usage |
|---|---|---|
render |
(none) | Frame rendering phase. Only valid callback for render.* drawing methods. |
createmove |
cmd: user_cmd_t |
Pre-aimbot tick processing. Writes to cmd are applied to the server packet. |
post_createmove |
cmd: user_cmd_t |
Post-engine tick processing snapshot. Read-only. |
antiaim |
ctx: antiaim_context_t |
Anti-aim calculation phase before final angles are built. |
frame_stage |
stage: number |
CS:GO FrameStageNotify hook. |
level_init |
(none) | Triggered when a new map finishes loading. |
game_events |
event: game_event_t |
Engine game events (player_death, player_hurt, bullet_impact, etc.). |
aim_shot |
shot: shot_t |
Ragebot client-side fire intent. |
aim_ack |
shot: shot_t |
Server response for a shot (hit/miss/spread/resolver). |
pre_anim_update |
player: player_t |
Local player, before animation update (globals.curtime matches tickbase). |
post_anim_update |
player: player_t |
Local player, after animation update. |
local_alpha |
player: player_t, alpha: number |
Return 0..1 to override local player chams opacity. |
draw_chams |
class: number |
Model draw interception hook for custom materials. |
voice_message |
data: recv_voice_data_t |
Incoming voice packet from another player. |
console_input |
command: string |
Intercepts console commands before execution. |
unload |
(none) | Script unload cleanup hook. |
Frame Stages (frame_stage)
Section titled โFrame Stages (frame_stage)โStages passed to frame_stage:
local FRAME_START = 0local FRAME_NET_UPDATE_START = 1local FRAME_NET_UPDATE_POSTDATAUPDATE_START = 2local FRAME_NET_UPDATE_POSTDATAUPDATE_END = 3local FRAME_NET_UPDATE_END = 4local FRAME_RENDER_START = 5local FRAME_RENDER_END = 6
client.add_callback("frame_stage", function(stage) if stage == FRAME_NET_UPDATE_END then -- Post-net-update logic endend)Custom Chams (draw_chams)
Section titled โCustom Chams (draw_chams)โThe draw_chams callback triggers before each model category renders:
Model Class IDs
Section titled โModel Class IDsโ| Class ID | Model Target |
|---|---|
0 |
Enemy player |
1 |
Shot model (hitmarker / impact chams) |
2 |
Backtrack record model |
3 |
Local player |
4 |
View model (first-person weapon & hands) |
5 |
Attachment (weapons in hand, defusers, grenades) |
Return Value Contract
Section titled โReturn Value Contractโ- Return
0: Takeover mode. Native rendering is blocked. You must draw the model withmaterials.draw_chams(mat). - Return
1: Passthrough mode. Game renders the model normally.
local flat_mat = materials.create("script/flat_chams", "UnlitGeneric", { basetexture = "vgui/white", ignorez = 1, nofog = 1,})
client.add_callback("draw_chams", function(class) -- Only override enemy players (class 0) if class ~= 0 then return 1 end
flat_mat:color_modulate(color(255, 40, 90)) materials.draw_chams(flat_mat)
return 0 -- Handledend)