# Events

## List of game events:

{% hint style="info" %}
In order to reference an event, index the `events` namespace with an event name
{% endhint %}

{% embed url="<https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events>" %}
Official CS:GO events
{% endembed %}

```lua
local hitgroup_str = {
    [0] = 'generic',
    'head', 'chest', 'stomach',
    'left arm', 'right arm',
    'left leg', 'right leg',
    'neck', 'generic', 'gear'
}

events.player_hurt:set(function(e)
    local me = entity.get_local_player()
    local attacker = entity.get(e.attacker, true)

    if me == attacker then
        local user = entity.get(e.userid, true)
        local hitgroup = hitgroup_str[e.hitgroup]

        print(('Hit %s in the %s for %d damage (%d health remaining)'):format(
            user:get_name(), hitgroup,
            e.dmg_health, e.health
        ))
    end
end)
```

## List of events:

### render

Fired every frame. Most functions from the [`render`](https://docs-csgo.neverlose.cc/documentation/variables/render) namespace can only be used here.

```lua
events.render:set(function(ctx)
    render.rect(vector(0, 0), vector(1920, 1080), color(230, 150))
end)
```

### render\_glow

Fired every time the game prepares glow object manager. This event gives you the ability to render glow lines. Access the function by adding an argument to the callback.

`ctx:render(from: vector, to: vector, thickness: number, flags: string, color: color)`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>from</strong></td><td><strong><code>vector</code></strong></td><td>Start position in world space</td></tr><tr><td><strong>to</strong></td><td><strong><code>vector</code></strong></td><td>Final position in world space</td></tr><tr><td><strong>thickness</strong></td><td><strong><code>number</code></strong></td><td>Line thickness as a number in the range [0.0, ∞]</td></tr><tr><td><strong>flags</strong></td><td><strong><code>string</code></strong></td><td>Glow flags. <mark style="color:blue;"><code>l</code></mark> to draw line, <mark style="color:blue;"><code>g</code></mark> to draw <code>glow</code> outline, or <mark style="color:blue;"><code>w</code></mark> to make it fully visible behind walls</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the line</td></tr></tbody></table>

<details>

<summary>🧷 Anti-aim direction glow lines</summary>

<img src="https://3594665820-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F37PG3extaxoGL9yvcP52%2Fuploads%2Ft95EElmDcmCyhBDlXM7z%2Fimage.png?alt=media&#x26;token=e3e05f2d-2cf1-4af1-b964-535d2c0033e9" alt="" data-size="original">

```lua
local real_yaw, abs_yaw = 0, 0

events.createmove:set(function(cmd)
    local me = entity.get_local_player()
    local anim_state = me:get_anim_state()

    if not anim_state or cmd.choked_commands > 0 then
        return
    end

    real_yaw = anim_state.eye_yaw
    abs_yaw = anim_state.abs_yaw
end)

events.render_glow:set(function(ctx)
    local me = entity.get_local_player()

    if not me or not me:is_alive() then
        return
    end

    local origin = me:get_origin()
    local real_yaw_dir = origin + (vector():angles(0, real_yaw) * 20)
    local abs_yaw_dir = origin + (vector():angles(0, abs_yaw) * 25)

    ctx:render(origin, real_yaw_dir, 0.15, 'lg', color(255, 0, 0)) -- Real yaw
    ctx:render(origin, abs_yaw_dir, 0.15, 'g', color(35, 215, 235)) -- Body yaw
end)
```

</details>

### override\_view

Fired every time the game prepares camera view.

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>fov</strong></td><td><strong><code>number</code></strong></td><td>Field of View</td></tr><tr><td><strong>view</strong></td><td><strong><code>vector</code></strong></td><td>Camera view angles</td></tr><tr><td><strong>camera</strong></td><td><strong><code>vector</code></strong></td><td>World position of the camera</td></tr></tbody></table>

### createmove

Fired every time the game prepares a move command. Use this to modify something before the aimbot or movement features. Use the parameter passed by the callback to access the [`UserCmd`](#struct-usercmd).

```lua
-- Sets the Roll angle when Shift (+speed) is being held
events.createmove:set(function(cmd)
    if cmd.in_speed then
        cmd.view_angles.z = 50 -- you are now unhittable
    end
end)
```

#### 🔗 struct <mark style="color:blue;">`UserCmd`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>block_movement</strong></td><td><strong><code>number</code></strong></td><td>Set to <mark style="color:blue;"><code>1</code></mark> to make the cheat slowdown you to the weapon's minimal speed or set to <mark style="color:blue;"><code>2</code></mark> to fully stop you. Defaults to <mark style="color:blue;"><code>0</code></mark></td></tr><tr><td><strong>no_choke</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>true</code></mark> to force the cheat to not choke the current command</td></tr><tr><td><strong>send_packet</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>false</code></mark> to force the cheat to choke the current command</td></tr><tr><td><strong>force_defensive</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>true</code></mark> to trigger <mark style="color:yellow;"><code>'defensive'</code></mark> exploit (Double tap is required to be fully charged)</td></tr><tr><td><strong>jitter_move</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>false</code></mark> to disable jitter move</td></tr><tr><td><strong>choked_commands</strong></td><td><strong><code>number</code></strong></td><td>Amount of choked commands</td></tr><tr><td><strong>command_number</strong></td><td><strong><code>number</code></strong></td><td>Current command number</td></tr><tr><td><strong>tickcount</strong></td><td><strong><code>number</code></strong></td><td>Current command tickcount</td></tr><tr><td><strong>random_seed</strong></td><td><strong><code>number</code></strong></td><td>Current command random seed</td></tr><tr><td><strong>view_angles</strong></td><td><strong><code>vector</code></strong></td><td>Player view angles</td></tr><tr><td><strong>move_yaw</strong></td><td><strong><code>number</code></strong></td><td>Movement yaw angle</td></tr><tr><td><strong>forwardmove</strong></td><td><strong><code>number</code></strong></td><td>Forward / backward speed</td></tr><tr><td><strong>sidemove</strong></td><td><strong><code>number</code></strong></td><td>Left / right speed</td></tr><tr><td><strong>upmove</strong></td><td><strong><code>number</code></strong></td><td>Up / down speed</td></tr></tbody></table>

<details>

<summary>🧷 Available cmd buttons</summary>

```lua
local on_createmove = function(cmd)
    cmd.in_attack -- +attack
    cmd.in_attack2 -- +attack2
    
    cmd.in_use -- +use
    cmd.in_jump -- +jump
    cmd.in_duck -- +duck
    cmd.in_walk -- +walk
    cmd.in_speed -- +speed
    cmd.in_reload -- +reload
    
    cmd.in_moveleft
    cmd.in_moveright
    cmd.in_forward
    cmd.in_back
    cmd.in_left
    cmd.in_right
    
    cmd.in_bullrush
end

events.createmove:set(on_createmove)
```

</details>

### createmove\_run

Fired every time the game runs a move command. Use the parameter passed by the callback to access the [`RunCommand`](#struct-usercmd-1).

#### 🔗 struct <mark style="color:blue;">`RunCommand`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>choked_commands</strong></td><td><strong><code>number</code></strong></td><td>Amount of choked commands</td></tr><tr><td><strong>command_number</strong></td><td><strong><code>number</code></strong></td><td>Current command number</td></tr><tr><td><strong>tick_count</strong></td><td><strong><code>number</code></strong></td><td>Current command tick count</td></tr><tr><td><strong>move_yaw</strong></td><td><strong><code>number</code></strong></td><td>Movement yaw angle</td></tr><tr><td><strong>forwardmove</strong></td><td><strong><code>number</code></strong></td><td>Forward / backward speed</td></tr><tr><td><strong>sidemove</strong></td><td><strong><code>number</code></strong></td><td>Left / right speed</td></tr><tr><td><strong>upmove</strong></td><td><strong><code>number</code></strong></td><td>Up / down speed</td></tr></tbody></table>

### aim\_fire

Fired every time the aimbot shoots at a player.

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>id</strong></td><td><strong><code>number</code></strong></td><td>Shot ID</td></tr><tr><td><strong>target</strong></td><td><strong><code>entity</code></strong></td><td>Target entity</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Estimated damage</td></tr><tr><td><strong>hitchance</strong></td><td><strong><code>number</code></strong></td><td>Estimated hit chance</td></tr><tr><td><strong>hitgroup</strong></td><td><strong><code>number</code></strong></td><td>Targeted hitgroup</td></tr><tr><td><strong>backtrack</strong></td><td><strong><code>number</code></strong></td><td>Amount of ticks the player was backtracked</td></tr><tr><td><strong>aim</strong></td><td><strong><code>vector</code></strong></td><td>World position of the aim point</td></tr><tr><td><strong>angle</strong></td><td><strong><code>vector</code></strong></td><td>Aimbot shoot angles</td></tr></tbody></table>

### aim\_ack

<table><thead><tr><th width="195.56818960672456">Name</th><th width="150">Type</th><th width="396.5818329607757">Description</th></tr></thead><tbody><tr><td><strong>id</strong></td><td><strong><code>number</code></strong></td><td>Shot ID</td></tr><tr><td><strong>target</strong></td><td><strong><code>entity</code></strong></td><td>Target entity</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Actual shot damage</td></tr><tr><td><strong>spread</strong></td><td><strong><code>number</code></strong></td><td>Bullet spread angle if available</td></tr><tr><td><strong>hitchance</strong></td><td><strong><code>number</code></strong></td><td>Actual shot hit chance</td></tr><tr><td><strong>hitgroup</strong></td><td><strong><code>number</code></strong></td><td>Hitgroup that was hit</td></tr><tr><td><strong>backtrack</strong></td><td><strong><code>number</code></strong></td><td>Amount of ticks the player was backtracked</td></tr><tr><td><strong>aim</strong></td><td><strong><code>vector</code></strong></td><td>World position of the aim point</td></tr><tr><td><strong>wanted_damage</strong></td><td><strong><code>number</code></strong></td><td>Targeted damage</td></tr><tr><td><strong>wanted_hitgroup</strong></td><td><strong><code>number</code></strong></td><td>Targeted hitgroup</td></tr><tr><td><strong>state</strong></td><td><strong><code>string</code></strong></td><td>Reason the shot was missed or nil if the shot was hit. Available miss reasons: <code>spread</code>, <code>correction</code>, <code>misprediction</code>, <code>prediction error</code>, <code>backtrack failure</code>, <code>damage rejection</code>, <code>unregistered shot</code>, <code>player death</code>, <code>death</code>.</td></tr></tbody></table>

### bullet\_fire

Fired every time someone fires a bullet.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that did the shot</td></tr><tr><td><strong>origin</strong></td><td><strong><code>vector</code></strong></td><td>Entity world position</td></tr><tr><td><strong>angles</strong></td><td><strong><code>vector</code></strong></td><td>Aim angle based on entity rotation</td></tr><tr><td><strong>sound</strong></td><td><strong><code>number</code></strong></td><td>Sound type</td></tr><tr><td><strong>spread</strong></td><td><strong><code>number</code></strong></td><td>Weapon spread</td></tr><tr><td><strong>inaccuracy</strong></td><td><strong><code>number</code></strong></td><td>Weapon inaccuracy</td></tr><tr><td><strong>recoil_index</strong></td><td><strong><code>number</code></strong></td><td>Weapon recoil index</td></tr><tr><td><strong>random_seed</strong></td><td><strong><code>number</code></strong></td><td>Spread seed of the shot</td></tr><tr><td><strong>weapon_id</strong></td><td><strong><code>number</code></strong></td><td>Weapon definition index</td></tr><tr><td><strong>weapon_mode</strong></td><td><strong><code>number</code></strong></td><td>Weapon fire mode</td></tr></tbody></table>

### console\_input

Fired every time the user runs a console command. Use the parameter passed by the callback to access the input string.

```lua
local last_random_int

events.console_input:set(function(text)
    if text == '/roll' then
        local random_int = utils.random_int(1, 6)

        local str = common.get_username() .. ' rolled a ' .. random_int
        if random_int == 1 and random_int == last_random_int then
            str = str .. '... snake eyes!'
        end

        print(str)

        last_random_int = random_int
        return false
    end
end)
```

This can be used to implement custom console commands. Return <mark style="color:purple;">`false`</mark> to prevent the game from processing the command.

### draw\_model

Fired before a model is rendered. Use the parameter passed by the callback to access the model context. Return <mark style="color:purple;">`false`</mark> to prevent the game from rendering the original model.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Name of the model. (e.g: <code>weapons\v_knife_cord.mdl</code>)</td></tr><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that belongs to the model.</td></tr><tr><td><strong>draw</strong></td><td><strong><code>function</code></strong></td><td>Draws the model with the specified material. Pass nil to the first argument to draw the model with the default material.</td></tr></tbody></table>

<details>

<summary>🧷 Draw model example</summary>

{% code lineNumbers="true" %}

```lua
local ct_fbi_glass = materials.get('models/player/ct_fbi/ct_fbi_glass', true)

events.draw_model:set(function(ctx)
    local me = entity.get_local_player()

    if ctx.entity == me then
        -- Override local player model with the new material
        ctx:draw(ct_fbi_glass)

        -- Prevent the game from drawing the original model
        return false
    end
end)
```

{% endcode %}

</details>

### level\_init

Fired after fully connected to the server (first non-delta packet received). (`SIGNONSTATE:FULL`)

### pre\_render

Fired before a frame is rendered. (`FrameStageNotify:FRAME_RENDER_START`)

### post\_render

Fired after a frame is rendered. (`FrameStageNotify:FRAME_RENDER_END`)

### net\_update\_start

Fired before the game processes entity updates from the server. (`FrameStageNotify:FRAME_NET_UPDATE_START`)

### net\_update\_end

Fired after an entity update packet is received from the server. (`FrameStageNotify:FRAME_NET_UPDATE_END`)

### config\_state

Fired every time config state is updated. The current state is accessible from the callback arguments as one of these strings: <mark style="color:blue;">`pre_save`</mark>, <mark style="color:blue;">`post_save`</mark>, <mark style="color:blue;">`pre_load`</mark>, <mark style="color:blue;">`post_load`</mark>.

{% code overflow="wrap" lineNumbers="true" %}

```lua
events.config_state(function(state)
    print(state == "pre_save")
end)
```

{% endcode %}

### mouse\_input

Fired every time the mouse input occurs. Return <mark style="color:purple;">`false`</mark> to lock the mouse input.

### shutdown

Fired when the script is about to unload.

### pre\_update\_clientside\_animation

Fired before C\_CSPlayer::UpdateClientSideAnimation is called.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>player</strong></td><td><strong><code>entity</code></strong></td><td>...</td></tr></tbody></table>

### post\_update\_clientside\_animation

Fired after C\_CSPlayer::UpdateClientSideAnimation is called.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>player</strong></td><td><strong><code>entity</code></strong></td><td>...</td></tr></tbody></table>

### grenade\_override\_view

Invoked to override the input values for the grenade prediction. Contains detailed view parameters associated with the grenade trajectory prediction.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>angles</strong></td><td><strong><code>vector</code></strong></td><td>Input view angles</td></tr><tr><td><strong>src</strong></td><td><strong><code>vector</code></strong></td><td>Input starting position or origin</td></tr><tr><td><strong>velocity</strong></td><td><strong><code>vector</code></strong></td><td>Input velocity</td></tr><tr><td><strong>view_offset</strong></td><td><strong><code>vector</code></strong></td><td>Input view offset</td></tr></tbody></table>

### grenade\_warning

Fired when the "Grenade Proximity Warning" is being rendered. Return `false` to it from being rendered.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>The game entity representing the grenade in proximity.</td></tr><tr><td><strong>origin</strong></td><td><strong><code>vector</code></strong></td><td>The current position of the grenade.</td></tr><tr><td><strong>closest_point</strong></td><td><strong><code>vector</code></strong></td><td>Represents the nearest point to the player where the grenade will cause damage. For example, in the case of a molotov, this point indicates where the flames would be most harmful.</td></tr><tr><td><strong>type</strong></td><td><strong><code>string</code></strong></td><td>Specifies the type of the grenade, "Frag" or "Molly".</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Predicts the potential damage that would be inflicted upon the local player if they remain at their current position when the grenade detonates.</td></tr><tr><td><strong>expire_time</strong></td><td><strong><code>number</code></strong></td><td>Specifies the time when the grenade detonates or is no longer a threat.</td></tr><tr><td><strong>icon</strong></td><td><strong><code>ImgObject</code></strong></td><td>A reference to the texture used in the warning.</td></tr><tr><td><strong>path</strong></td><td><strong><code>table</code></strong></td><td>Table of 3D vectors representing the complete trajectory path of the grenade.</td></tr></tbody></table>

### grenade\_prediction

Fired when the cheat is drawing the predicted grenade trajectory. Contains detailed information about the grenade's trajectory and impact.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>type</strong></td><td><strong><code>string</code></strong></td><td>Identifies the type of the grenade, e.g., "Smoke", "Flash", "Frag".</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Represents the amount of damage inflicted upon the <code>target</code> due to the grenade's effect.</td></tr><tr><td><strong>fatal</strong></td><td><strong><code>boolean</code></strong></td><td>Indicates whether the grenade's effect resulted in a lethal outcome for the <code>target</code>.</td></tr><tr><td><strong>path</strong></td><td><strong><code>table</code></strong></td><td>Table of 3D vectors representing the complete trajectory path of the grenade.</td></tr><tr><td><strong>collisions</strong></td><td><strong><code>table</code></strong></td><td>Table of 3D vectors containing all the collision points where the grenade interacts with an obstacle or wall.</td></tr><tr><td><strong>target</strong></td><td><strong><code>entity</code></strong></td><td>The game entity that the grenade directly impacts or affects.</td></tr></tbody></table>

### localplayer\_transparency

Invoked to override the opacity of the local player's model. You can override it by returning a custom alpha value.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>current_alpha</strong></td><td><strong><code>number</code></strong></td><td>The current alpha. Ranges from 0 (completely transparent) to 255 (completely opaque).</td></tr></tbody></table>

## List of complicated events:

### voice\_message

Fired every time the game receives a voice packet.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that belongs to the voice packet.</td></tr><tr><td><strong>audible_mask</strong></td><td><strong><code>number</code></strong></td><td>Audible mask</td></tr><tr><td><strong>xuid</strong></td><td><strong><code>number</code></strong></td><td>Xuid</td></tr><tr><td><strong>proximity</strong></td><td><strong><code>number</code></strong></td><td>Proximity</td></tr><tr><td><strong>format</strong></td><td><strong><code>number</code></strong></td><td>Format</td></tr><tr><td><strong>sequence_bytes</strong></td><td><strong><code>number</code></strong></td><td>Sequence bytes</td></tr><tr><td><strong>section_number</strong></td><td><strong><code>number</code></strong></td><td>Section number</td></tr><tr><td><strong>uncompressed_sample_offset</strong></td><td><strong><code>number</code></strong></td><td>Uncompressed sample offset</td></tr><tr><td><strong>buffer</strong></td><td><strong><code>bf_read</code></strong></td><td>Voice packet buffer</td></tr><tr><td><strong>is_nl</strong></td><td><strong><code>boolean</code></strong></td><td>Packet was sent by the Neverlose</td></tr></tbody></table>

#### 🔗 struct <mark style="color:blue;">`bf_read`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>read_bits</strong></td><td><strong><code>function</code></strong></td><td>Reads a number value from the buffer <code>:read_bits(num_bits)</code></td></tr><tr><td><strong>read_coord</strong></td><td><strong><code>function</code></strong></td><td>Reads a floating number value from the buffer <code>:read_coord()</code> (4 bytes)</td></tr><tr><td><strong>reset</strong></td><td><strong><code>function</code></strong></td><td>Resets the pointer of the buffer to its original offset</td></tr><tr><td><strong>crypt</strong></td><td><strong><code>function</code></strong></td><td>Encrypts/decrypts buffer <code>:crypt(key)</code></td></tr></tbody></table>

#### 🔗 struct <mark style="color:blue;">`bf_write`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>write_bits</strong></td><td><strong><code>function</code></strong></td><td>Writes a number value to the buffer <code>:write_bits(value, num_bits)</code></td></tr><tr><td><strong>write_coord</strong></td><td><strong><code>function</code></strong></td><td>Writes a floating number value to the buffer <code>:write_coord(value)</code> (4 bytes)</td></tr><tr><td><strong>is_overflowed</strong></td><td><strong><code>function</code></strong></td><td>Returns <mark style="color:blue;"><code>true</code></mark> if the buffer is overflowed</td></tr><tr><td><strong>crypt</strong></td><td><strong><code>function</code></strong></td><td>Encrypts/decrypts buffer <code>:crypt(key)</code></td></tr></tbody></table>

> 📌 Firing this event from the Lua will send a voice packet
>
> `events.voice_message(function: buffer)`

```lua
events.voice_message(function(ctx)
    local buffer = ctx.buffer
    local code = buffer:read_bits(16)

    if code ~= 0x1337 then
        return
    end

    local tickcount = buffer:read_bits(32)

    print(string.format(
        'received voice packet from %s | pct_tickcount: %d',
        ctx.entity:get_name(), tickcount
    ))
end)

-- Note that you wont be able to receive your own voice packet
-- unless voice_loopback convar is set to 1
events.voice_message:call(function(buffer)
    buffer:write_bits(0x1337, 16)
    buffer:write_bits(globals.tickcount, 32)
end)
```

> `[neverlose] received voice packet from Salvatore | pct_tickcount: 1200`
