> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: events
description: Hook into game callbacks such as paint and createmove
icon: zap
---

The `events` namespace lets you hook into game callbacks. Index `events` with an event name to get an `event_object`, then register, remove, or fire callbacks with the methods below.

<Card title="Browse all events" icon="zap" href="/csgo/events/cheat-events" arrow>
  The full list of event names you can hook — cheat, CS:GO, and generic Source events — each with its callback signature.
</Card>

## set

```lua
events.event_name:set(callback: function)
```

> Sets the callback for the specified event. The registered function is called every time the event occurs.

<Schema title="Parameters">
  <SchemaField name="callback" type="function" required>
    Lua function to call.
  </SchemaField>
</Schema>

## unset

```lua
events.event_name:unset(callback: function)
```

> Unsets a callback that was set via `:set` from the specified event.

<Schema title="Parameters">
  <SchemaField name="callback" type="function" required>
    The Lua function that was passed to `:set`.
  </SchemaField>
</Schema>

## call

```lua
events.event_name:call(...)
```

> Fires the specified event.

<Schema title="Parameters">
  <SchemaField name="..." type="any">
    Arguments to be passed to the callback.
  </SchemaField>
</Schema>

## \_\_call

```lua
events.event_name(callback: function[, state: boolean])
```

> Sets or unsets the callback for the specified event — a shorthand alternative to `:set` / `:unset`.

<Schema title="Parameters">
  <SchemaField name="callback" type="function" required>
    Lua function to call.
  </SchemaField>

  <SchemaField name="state" type="boolean">
    Optional. Callback state. If omitted, toggles the callback state for the specified function.
  </SchemaField>
</Schema>

Omitting `state` toggles the callback on each call; passing an explicit boolean sets or unsets it deterministically.

<Expandable title="Example">
  ```lua Toggle behavior lines=false
  local function function_callback()
      print(globals.tickcount)
  end

  -- Sets the createmove callback for the specified function
  events.createmove(function_callback)

  -- Execute after 0.5 secs
  utils.execute_after(0.5, function()
      -- Toggles the createmove callback for the specified function
      events.createmove(function_callback)
  end)
  ```

  ```lua State behavior lines=false
  local function function_callback()
      print(globals.tickcount)
  end

  events.createmove(function_callback, true)  -- Sets the callback
  events.createmove(function_callback, false) -- Unsets the callback
  ```
</Expandable>
