this callback is called every time csgo fires an event, along with it the event object is passed.
you can get a list of all events and their fields here
localfunctionon_event(event)print("received event", event.name)-- only react to specific eventsif event.name =="player_death" then -- all fields can be found here: https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events#player_death
print("a player got killed by a", event.weapon)-- all event fields are also mutable-- the following code will force all kills to show as headshots event.headshot =trueendendcallbacks.add(e_callbacks.EVENT, on_event)
alternatively, if you only want to react to a specific event, there is an optional argument you can pass into the callbacks.add function
-- this function will only be called for "player_death" eventslocalfunctionon_player_death(event)-- all fields can be found here: https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events#player_deathprint("a player got killed by a", event.weapon)endcallbacks.add(e_callbacks.EVENT, on_event, "player_death")