> For the complete documentation index, see [llms.txt](https://lua.legacy.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lua.legacy.fatality.win/csgo/interfaces/events.md).

# Events

csgo.interface\_handler:get\_events( )

## Functions

### add\_event

adds an event to the event manager

`events:add_event( event_name )`

|  Parameter  | Data type |                                         Description                                         |
| :---------: | :-------: | :-----------------------------------------------------------------------------------------: |
| event\_name |   string  | [name of event to add](https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events) |

## Cheat Events

### level\_init

called once the map and all entities have been initialized

## Example

```lua
local Events        = csgo.interface_handler:get_events()
local Callbacks     = fatality.callbacks

-- function to be called when a game event is fired
local function OnGameEvent(Event)
    
    local EventName = Event:get_name()
    
    -- Check if the event that is called is the one we want
    if EventName == "player_hurt" then
        print("A player was hurt")
    end
end

-- Add player_hurt to our event manager
Events:add_event("player_hurt")
-- Add our function to the events callback
Callbacks:add("events", OnGameEvent)
```
