Callbacks

List of all callbacks:

on_command

This callback will be executed on every command before it's processed.

Parameters passed in callback:

Name
Type
Description
cmd
usercmd
pre-processed command
1
function on_command(cmd)
2
cmd.viewangles.x = 0
3
end
Copied!

on_esprender

This callback will be executed when a player's ESP is rendered.

Parameters passed in callback:

Name
Type
Description
ESP
esp
passed ESP type
1
function on_esprender(esp)
2
player = esp:get_player()
3
4
if player:is_valid() and player:is_enemy() then
5
esp:top_text("enemy", color.new(255, 255, 255))
6
end
7
end
Copied!

on_gameevent

This callback will be executed when a game event occurs.

Parameters passed in callback:

Name
Type
Description
Event
gameevent
passed game event
1
function on_gameevent(event)
2
utils.log(event:get_name() .. "\n", color.new(255, 255, 255))
3
end
Copied!

on_framestagenotify

This callback will be executed at stages of preparation for each frame.

Parameters passed in callback:

Name
Type
Description
Stage
stage
passed stage enum
1
function on_framestagenotify(stage)
2
if stage == stages.frame_render_start then
3
-- do shit here
4
end
5
end
Copied!

on_render

This callback will be executed for every rendered frame.
1
function on_render()
2
renderer.logo(0, 0, 50, 50, color.new(255, 255, 255, 150))
3
end
Copied!

on_modelrender

This callback will be executed when rendering a model.

Parameters passed in callback:

Name
Type
Description
Model
model
passed model type
1
function on_modelrender(model)
2
if string.find(model:get_name(), "models/player") then
3
-- do shit here
4
end
5
end
Copied!

on_shutdown

This callback will be executed before a script is unloaded.
1
function on_shutdown()
2
my_cvar.set_value(default_value)
3
end
Copied!