> 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/advanced-clothing/developers/events.md).

# Events

Open menus by event, and react when a menu closes or a character is created.

## Events you can trigger

Each one calls the matching [export](/visionstore-docs/scripts/advanced-clothing/developers/exports.md). Trigger them from a client script with `TriggerEvent`, or from the server with `TriggerClientEvent` (that is how `/clothingshop` and `/wardrobe` open the menu).

| Event                                                 | Arguments                        | Same as                                     |
| ----------------------------------------------------- | -------------------------------- | ------------------------------------------- |
| `Chapo_advanced_clothing:client:openAppearance`       | `(options)`                      | `OpenAppearance`                            |
| `Chapo_advanced_clothing:client:openShop`             | `(shopId, overrides)`            | `OpenClothingShop`                          |
| `Chapo_advanced_clothing:client:openWardrobe`         | `(options)`                      | `OpenWardrobe`                              |
| `Chapo_advanced_clothing:client:openOutfitBag`        | `(bagId, options)`               | `OpenOutfitBag`                             |
| `Chapo_advanced_clothing:client:openJobWardrobe`      | `(options)`                      | `OpenJobWardrobe`                           |
| `Chapo_advanced_clothing:client:openGangWardrobe`     | `(options)`                      | `OpenGangWardrobe`                          |
| `Chapo_advanced_clothing:client:openAdmin`            | `(options)`                      | `OpenAdminClothing`                         |
| `Chapo_advanced_clothing:client:openBarber`           | `(shopId or options, overrides)` | `OpenBarber`                                |
| `Chapo_advanced_clothing:client:openTattooShop`       | `(shopId or options, overrides)` | `OpenTattooShop`                            |
| `Chapo_advanced_clothing:client:openSurgeon`          | `(shopId or options, overrides)` | `OpenSurgeon`                               |
| `Chapo_advanced_clothing:client:openCharacterCreator` | `(options)`                      | `OpenCharacterCreator`                      |
| `Chapo_advanced_clothing:client:setLocale`            | `(code)`                         | `SetPlayerLocale`                           |
| `Chapo_advanced_clothing:client:close`                | `()`                             | `CloseClothingUI`                           |
| `Chapo_advanced_clothing:client:forceClose`           | `(reason)`                       | Closes any menu, even the character creator |

```lua
-- client side
TriggerEvent("Chapo_advanced_clothing:client:openShop", "suburban_grove")
TriggerEvent("Chapo_advanced_clothing:client:openWardrobe", { mode = "home" })
TriggerEvent("Chapo_advanced_clothing:client:openBarber", "barber_rockford")

-- server side
TriggerClientEvent("Chapo_advanced_clothing:client:openWardrobe", playerId, {})
TriggerClientEvent("Chapo_advanced_clothing:client:forceClose", playerId, "admin")
```

{% hint style="warning" %}
Opening a menu by event doesn't bypass anything: the server still checks access, sections, prices and distance. `openAdmin` on a player without the admin ace (or a fresh `/clothingshop` grant) answers **NOT ALLOWED**.
{% endhint %}

## Events fired by the script

Listen with `AddEventHandler` on the client.

| Event                                             | Arguments        | When                                                                                                       |
| ------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------- |
| `Chapo_advanced_clothing:client:sessionClosed`    | `(mode, reason)` | Any Vision Clothing menu closed                                                                            |
| `Chapo_advanced_clothing:client:characterCreated` | `(appearance)`   | The character creator saved and closed. `appearance` is the final illenium appearance table, already saved |

`mode` is the menu's mode (`shop`, `barber`, `wardrobe`, `character_creator`...). `reason` is:

| `reason`    | Meaning                                                                                   |
| ----------- | ----------------------------------------------------------------------------------------- |
| `"confirm"` | The main button closed the menu (the creator's SAVE CHARACTER)                            |
| `"cancel"`  | ESC, `CloseClothingUI`, the distance or death check, `forceClose`                         |
| `"force"`   | A close that had to ignore `allowCancel`, the outfit bag being picked up, a resource stop |

Shops and wardrobes stay open after CONFIRM / EQUIP, so leaving them afterwards reports `"cancel"`. What was bought or equipped is already saved by then. For the creator, `sessionClosed` with `"confirm"` fires just before `characterCreated`.

There is no "opened" event: use the return value of the `Open*` export you called, or `IsClothingUIOpen()`.

```lua
-- client side: show your HUD again when a clothing menu closes
AddEventHandler("Chapo_advanced_clothing:client:sessionClosed", function(mode, reason)
    -- mode: "shop", "barber", "wardrobe", ... ; reason: "confirm" | "cancel" | "force"
    exports.my_hud:SetVisible(true)   -- your HUD's own export
end)
```

## Other client events

| Event                                        | Arguments          | Meaning                                                                                                                 |
| -------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| `Chapo_advanced_clothing:client:moneyUpdate` | `({ cash, bank })` | Refreshes the cash / bank boxes while the menu is open. Vision Clothing's server doesn't send it; a banking script may. |

```lua
-- server side of a banking script, after changing a player's balance
TriggerClientEvent("Chapo_advanced_clothing:client:moneyUpdate", src, { cash = 1200, bank = 54000 })
```


---

# 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/advanced-clothing/developers/events.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.
