Callbacks

Although this api does not use true callbacks, they will be referred to as such.

How to use

To create a callback you need to use one of the many names listed below to access them.

-- Callbacks CANNOT be local
-- "local function on_shot_fired" will not work

function on_shot_fired(shot_info)
    print(string.format("Expected damage: %i", shot_info.client_damage)
end

function on_paint()
    render.rect_filled(10, 10, 110, 110, render.color("#FFFFFF"))
end

Callbacks

on_paint

function on_paint()
    render.rect_filled(10, 10, 110, 110, render.color("#FFFFFF"))
end

Usage:

Called every frame.

Use to draw with the render namespace.

on_paint_traverse

function on_paint_traverse()

end

Usage:

Called every frame.

Use this to call surface functions with ffi.

on_frame_stage_notify

function on_frame_stage_notify(stage, pre_original)
    if stage == csgo.frame_render_start then
        print("Rendering has started!")
    end
end

Parameter

Datatype

Description

stage

stage called on

pre_original

boolean

whether or not frame_stage_notify has been called yet

Frame stages
  • frame_undefined

  • frame_start

  • frame_render_start

  • frame_net_update_start

  • frame_net_update_postdataupdate_start

  • frame_net_update_postdataupdate_end

  • frame_net_update_end

  • frame_render_end

Usage:

Called when on a specific frame.

on_setup_move

function on_setup_move(cmd)
    cmd:set_move(xxx)
end

Parameter

Datatype

Description

cmd

user_cmd

user command

Usage:

Called every game tick before the command is used internally.

Use to call movement related things.

on_run_command

function on_run_command(cmd)
    cmd:set_view_angles(xxx)
end

Parameter

Datatype

Description

cmd

user_cmd

user command

Usage:

Called for every tick in a choked cycle the moment it is going to be sent to the server, after the cheat's anti-aim has run.

Use to change angles without cheat interference. All angle changes will be movement corrected.

on_create_move

function on_create_move(cmd)
    do_anti_aim()
end

Parameter

Datatype

Description

cmd

user_cmd

user command

Usage:

Called every game tick after everything internally has finished.

Use to run something on a per-tick basis that does not modfy commands.

on_input

function on_input(msg, wParam, lParam)

end

Parameter

Datatype

Description

wParam

number

used to pass values with specific messages

lParam

number

used to pass values with specific messages

Usage:

Called on wndproc.

on_console_input

function on_console_input(input)
    
end

Parameter

Datatype

Description

input

string

console input

on_shutdown

function on_shutdown()
    
end

Usage:

Called when the script is unloaded.

on_shot_registered

function on_shot_registered(shot_info)
    print(string.format("Expected damage: %i", shot_info.client_damage))
end

Parameter

Datatype

Description

shot_info

shot_info

the shots information

Usage:

Called after a shot has been fired.

Use to get information about shots.

on_level_init

function on_level_init()
    
end

Usage:

Called after the map has loaded.

on_game_event

function on_game_event(event)

end

Parameter

Datatype

Description

event

game_event

game event

Usage:

Called on any game event.

on_xxx

function on_item_pickup(event)

end

Parameter

Datatype

Description

event

game_event

game event

Usage:

Called on a specific game event.

Read the list of events and prefix one with "on_" to set a callback to it.

on_do_post_screen_space_events

function on_do_post_screen_space_events()

end

Usage:

Called after post processing has finished.

on_config_load

function on_config_load()

end

Usage:

Called after a config is loaded.

on_config_save

function on_config_save()

end

Usage:

Called after a config has been saved.

on_esp_flag

function on_esp_flag(index)
    return
    {
        render.esp_flag("first extra flag", render.color("#FFFFFF")),
        render.esp_flag("second extra flag", render.color("#FFFFFF")),
    }
end

Parameter

Datatype

Description

index

integer

index of player drawing

Return a table of flags that you want to add

on_draw_model_execute

function on_draw_model_execute(dme, ent_index, model_name)
   
   -- How to do overlay cham
   dme() -- call dme to draw the model with the normal material
   mat.override_material(overlay_mat) -- set the overlay material
   -- you do not need to call dme again. it is called after the callback
end

Parameter

Datatype

Description

dme

function

calls dme (draws the model)

ent_index

integer

entity's index

model_name

string

model's name

Player callbacks

on_player_connect

function on_player_connect(event)
    print("player connected")
end

Parameter

Datatype

Description

event

game_event

game event

Usage:

Called after a player has connected.

on_player_disconnect

function on_player_disconnect(event)

end

Parameter

Datatype

Description

event

game_event

game event

Usage:

Called after a player has disconnected.

on_player_spawn

function on_player_spawn(event)

end

Parameter

Datatype

Description

event

game_event

game event

Usage:

Called after a player has spawned.

on_player_hurt

function on_player_hurt(event)

end

Parameter

Datatype

Description

event

game_event

game event

Usage:

Called after a player has been hurt.

on_player_death

function on_player_death(event)

end

Parameter

Datatype

Description

event

game_event

game event

Usage:

Called after a player has died.

Last updated