Skip to main content

Fixed callbacks

Register with traceless.events.on(name, callback). Names are exact and case-sensitive. Callbacks are script-owned; errors are logged without automatically removing the registration. Except console_input, callback return values are ignored. Command, View, and GameEvent proxies are invalidated immediately after their individual callback returns. Shot tables are independent snapshots and may be retained.

paint​

Callback: function().

Runs while the renderer processes the in-game frame when connected. Draw game overlays here.

paint_ui​

Callback: function().

Runs during UI frame rendering, including when the game connection is unavailable. Draw UI overlays here.

net_update_start​

Callback: function().

Dispatched at native frame stage 5 before the relevant network-update work.

net_update_end​

Callback: function().

Dispatched at native frame stage 6 after the relevant network-update work.

pre_render​

Callback: function().

Dispatched at native frame stage 8, before Traceless render-start work and the original client frame-stage handler.

post_render​

Callback: function().

Dispatched at native frame stage 9, after the original client frame-stage handler.

command.setup​

Callback: function(command).

Receives mutable Command userdata at the beginning of Traceless command handling, before command-modifying features.

predict_command​

Callback: function(command).

Receives Command userdata after Traceless prediction when that prediction path runs.

end_command​

Callback: function(command).

Receives Command userdata at the end of Traceless command handling, after its command-modifying features. This callback does not initiate a new prediction pass.

prediction_update​

Callback: function().

Runs after the engine ClientSidePredict call and is suppressed during Traceless internal prediction passes.

override_view​

Callback: function(view).

Receives mutable View userdata after Traceless view adjustments, immediately before the original client override-view handler. The original client handler can perform further work after this callback.

console_input​

Callback: function(text).

Receives the command string on the intercepted Panorama console-input path, when no script is currently executing. Returning any truthy value marks input handled and suppresses the original command handler; other callback results are ignored. All matching callbacks can still run. Calls originating from a running script, including console.execute, do not recursively dispatch this callback.

shutdown​

Callback: function().

Runs for the unloading script before its owned callbacks/resources are destroyed. Replacement/unload invalidates those resources.

aim_fire​

Callback: function(shot).

Receives a Shot snapshot when the shot manager records a fired shot.

aim_hit​

Callback: function(shot).

Receives a Shot snapshot when the shot manager resolves a successful hit.

aim_miss​

Callback: function(shot).

Receives a Shot snapshot when the shot manager resolves a miss/failure.

Game events​

The client event listener subscribes its built-in list of CS2 event names. The Lua dispatcher forwards each received event under its native name, without a separate Lua binding for each event. Use a subscribed name such as player_hurt or round_start. Dispatch depends on the event actually reaching that client; events.on does not add native subscriptions or request server delivery. This implementation does not load or refresh game-event definition files at runtime, so new game events can require a client update.

The callback receives GameEvent userdata. Its name field identifies the event. Other field names come from the game's current definitions and are resolved as strings or integers by the proxy. Do not assume typed boolean/float field preservation or retain the proxy after the callback.

local traceless = require("traceless")
traceless.events.on("player_hurt", function(event)
local victim = traceless.players.from_userid(event.userid)
traceless.console.info(event.name, ": ", event.dmg_health)
end)

vpk_mount​

Callback: function(event).

Dispatched only to the mount's owning script after frame activation or unmount. The table contains handle, asset, state, and error; see VPK payloads and timing. Background validation never invokes Lua. Failed initialization candidates are destroyed and logged before becoming active.