> For the complete documentation index, see [llms.txt](https://visionstore.gitbook.io/visionstore-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://visionstore.gitbook.io/visionstore-docs/scripts/boxing-creator/developers/client-hooks.md).

# Client hooks

Client hooks in open/cl\_hooks.lua for effects, sounds, cameras and other HUDs.

Edit `open/cl_hooks.lua`. These run on **the fighter's own game**: use them for visuals and feel, never for money or results (that's the server's job).

## Reference

| Hook           | Arguments    | When                                                    |
| -------------- | ------------ | ------------------------------------------------------- |
| `onEnterRing`  | `fight`      | This player walks out to fight                          |
| `onRoundStart` | `round`      | A round countdown begins                                |
| `onFightEvent` | `kind, data` | Any event of this player's fight                        |
| `onHitLanded`  | `hit`        | This player landed a punch                              |
| `onHitTaken`   | `hit`        | This player took a punch                                |
| `onFinish`     | `result`     | The result is in                                        |
| `onLeaveRing`  | `ringId`     | This player left the ring (clothes and health are back) |
| `canUseGloves` | none         | The gloves item was used. Return `false` to refuse      |
| `onGloves`     | `wearing`    | Gloves went on (`true`) or off (`false`)                |

```lua
fight  = { ringId, corner, opponent, settings }      -- opponent = server id
hit    = { by, dmg, heavy, combo, hp, maxHp }         -- by = the attacker's corner
result = { won, draw, kind }
-- onFightEvent kinds: 'betting' 'intro' 'round' 'fight' 'roundEnd' 'knockdown' 'count' 'rise' 'special' 'bet' 'cancelled'
```

## Examples

{% tabs %}
{% tab title="Phone / other HUD" %}

```lua
function Hooks.onEnterRing(fight)
    TriggerEvent('my-phone:setDisabled', true)
end

function Hooks.onLeaveRing(ringId)
    TriggerEvent('my-phone:setDisabled', false)
end
```

{% endtab %}

{% tab title="Screen effect on power punches" %}

```lua
function Hooks.onHitTaken(hit)
    if hit.heavy then
        AnimpostfxPlay('FocusOut', 400, false)
    end
end
```

{% endtab %}

{% tab title="Victory emote" %}

```lua
function Hooks.onFinish(result)
    if result.won and (result.kind == 'ko' or result.kind == 'tko') then
        ExecuteCommand('e flex')   -- your emote menu
    end
end
```

{% endtab %}

{% tab title="Gloves only in gyms" %}

```lua
local GYMS = { vector3(-1201.0, -1568.0, 4.6) }

function Hooks.canUseGloves()
    local pos = GetEntityCoords(PlayerPedId())
    for _, gym in ipairs(GYMS) do
        if #(pos - gym) < 40.0 then return true end
    end
    Bridge.notify('You can only put gloves on at a gym.', 'error')
    return false
end
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://visionstore.gitbook.io/visionstore-docs/scripts/boxing-creator/developers/client-hooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
