☎ïļ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

Called every frame.

Use to draw with the render namespace.

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

on_paint_traverse

Called every frame.

Use this to call surface functions with ffi.

function on_paint_traverse()

end

on_frame_stage_notify

Called when on a specific frame.

stage

stage called on

pre_original

boolean

whether or not frame_stage_notify has been called yet

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

  • csgo.frame_net_update_end

  • csgo.frame_net_update_postdataupdate_end

  • csgo.frame_net_update_postdataupdate_start

  • csgo.frame_net_update_start

  • csgo.frame_render_start

  • csgo.frame_start

  • csgo.frame_undefined

on_setup_move

Called every game tick before the command is used internally.

Use to call movement-related things.

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

on_run_command

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.

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

on_create_move

Called every game tick after everything internally has finished.

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

cmd

user command

send_packet

boolean

true if a packet will be sent

function on_create_move(cmd, send_packet)
    do_anti_aim()
end

on_input

Called on wndproc.

wParam

number

used to pass values with specific messages

lParam

number

used to pass values with specific messages

function on_input(msg, wParam, lParam)

end

on_console_input

input

string

console input

function on_console_input(input)
    
end

on_shutdown

Called when the script is unloaded.

function on_shutdown()
    
end

on_shot_registered

Called after a shot has been fired.

Use to get information about shots.

shot_info

the shots information

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

on_level_init

Called after the map has loaded.

function on_level_init()
    
end

on_game_event

Called on any game event.

function on_game_event(event)

end

on_xxx

Called on a specific game event.

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

function on_item_pickup(event)

end

on_do_post_screen_space_events

Called after post processing has finished.

function on_do_post_screen_space_events()

end

on_config_load

Called after a config is loaded.

function on_config_load()

end

on_config_save

Called after a config has been saved.

function on_config_save()

end

on_esp_flag

index

integer

index of player drawing

Return a table of flags that you want to add

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

on_draw_model_execute

dme

function

calls dme (draws the model)

ent_index

integer

entity's index

model_name

string

model's name

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

Player callbacks

on_player_connect

Called after a player has connected.

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

on_player_disconnect

Called after a player has disconnected.

function on_player_disconnect(event)

end

on_player_spawn

Called after a player has spawned.

function on_player_spawn(event)

end

on_player_hurt

Called after a player has been hurt.

function on_player_hurt(event)

end

on_player_death

Called after a player has died.

function on_player_death(event)

end

Last updated