> 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/exports.md).

# Exports

Client and server exports, and every option you can pass when opening a menu.

```lua
local clothing = exports.Chapo_advanced_clothing
```

## Client exports

`OpenAppearance(options)` is the single entry point. Every other `Open*` export is a shortcut that fills in the mode for you. They all return `ok, reason`.

| Export                                         | Arguments                             | What it opens                                                                                           |
| ---------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `OpenAppearance(options)`                      | [Open options](#open-options)         | Any context                                                                                             |
| `OpenClothingShop(shopId, overrides)`          | A `Config.Shops` id, optional options | A store, exactly as configured                                                                          |
| `OpenWardrobe(options)`                        | Optional options                      | The personal wardrobe. Use `mode = "home"` for housing, `wardrobeId` for a `Config.Wardrobes` entry     |
| `OpenJobWardrobe(options)`                     | Optional options                      | Job locker: `Config.JobOutfits[job]` plus illenium boss-managed outfits                                 |
| `OpenGangWardrobe(options)`                    | Optional options                      | Gang locker: `Config.GangOutfits`                                                                       |
| `OpenOutfitBag(bagId, options)`                | A placed bag id                       | The outfits in that bag. Normally opened by the bag's target options                                    |
| `OpenOutfitEditor(outfitId, options)`          | A `player_outfits.id` the player owns | The wardrobe on that outfit, to update it                                                               |
| `OpenAdminClothing(options)`                   | Optional options                      | The free admin menu (needs the admin ace or a recent `/clothingshop` grant)                             |
| `OpenBarber(shopId or options, overrides)`     | Shop id **or** an options table       | HAIR, `barber` profile                                                                                  |
| `OpenTattooShop(shopId or options, overrides)` | Same                                  | TATTOOS, `tattoos` profile                                                                              |
| `OpenSurgeon(shopId or options, overrides)`    | Same                                  | FACE & BODY + FACE ADJUSTMENTS, flat `surgery` price                                                    |
| `OpenCharacterCreator(options)`                | Optional options                      | The character creator (all six sections, free)                                                          |
| `GetCurrentPreview()`                          | None                                  | `{ components = { [id] = { drawable, texture } }, props = { ... } }` or `nil` when closed               |
| `CloseClothingUI()`                            | None                                  | Closes as a cancel (original look restored). `false` if nothing was open or cancel is refused (creator) |
| `IsClothingUIOpen()`                           | None                                  | `true` while a menu is open                                                                             |
| `SetPlayerLocale(code)`                        | `"en"`, `"ar"`...                     | Switches the player's language. Refused with `not_allowed` when `Config.AllowPlayerLocale = false`      |
| `GetCustomPed()`                               | None                                  | The model assigned to this player's character with `/giveped`, or `nil`                                 |
| `ResolvePedModelName(hash)`                    | Model hash                            | A ped name this client knows, or `nil` (used by the illenium step 4 edit)                               |

**`reason` values:** `already_open`, `ped_loading` (a custom ped is still being put on), `backend_unavailable` (illenium-appearance not started), `invalid_shop`, `invalid_wardrobe`, `not_allowed`, `invalid_locale`, `error`, or a server reason such as `too_far`, `no_session` or `bag_missing`.

```lua
-- Open Binco Strawberry exactly as configured
exports.Chapo_advanced_clothing:OpenClothingShop("binco_strawberry")

-- Same shop, but only tops and bottoms, free, with a custom title
exports.Chapo_advanced_clothing:OpenClothingShop("binco_strawberry", {
    title = "BINCO PROMO",
    categories = { "tops", "bottoms" },
    free = true,
})

-- The shipped barber / tattoo / surgeon entries
exports.Chapo_advanced_clothing:OpenBarber("barber_rockford")
exports.Chapo_advanced_clothing:OpenTattooShop("tattoo_vinewood")
exports.Chapo_advanced_clothing:OpenSurgeon("surgeon_pillbox")

-- Any context, explicitly
exports.Chapo_advanced_clothing:OpenAppearance({
    mode = "salon",
    sections = { "hair", "overlays" },
    title = "MIRROR PARK SALON",
    startSection = "hair",
})

-- Query / close
if exports.Chapo_advanced_clothing:IsClothingUIOpen() then
    local preview = exports.Chapo_advanced_clothing:GetCurrentPreview()
    print(preview.components[11].drawable, preview.components[11].texture)
    exports.Chapo_advanced_clothing:CloseClothingUI()
end
```

### illenium hand-over exports

`HandleIlleniumOpen(kind, subType, isPedMenu, menuData)` and `HandleIlleniumCreator(gender, onSubmit, onCancel)` are called by the lines you add to illenium's `client/client.lua` ([illenium-appearance setup](/visionstore-docs/scripts/advanced-clothing/illenium-setup.md)). They return `true` when Vision Clothing took the request and `false` to let illenium open its own menu. You don't call them yourself.

`useOutfitBag` is the client export of the outfit bag items in ox\_inventory. Don't call it directly.

## Open options

The table accepted by `OpenAppearance` and every `Open*` export. Every field is optional, except `shopId` for the `shop`, `boutique` and `event` modes and `bagId` for `outfit_bag`.

| Option             | Type              | What it does                                                                                                                                                                                                                                                                                            |
| ------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`             | string            | `shop`, `boutique`, `event`, `admin`, `wardrobe`, `outfit_bag`, `home`, `job`, `gang`, `barber`, `salon`, `tattoo_shop`, `surgeon`, `cosmetic`, `character_creator`. Aliases: `clothing` → `shop`, `tattoo` → `tattoo_shop`, `hair` → `barber`, `surgery` → `surgeon`, `creator` → `character_creator`. |
| `sections`         | list              | Sections to show: `face_body`, `face_adjustments`, `overlays`, `hair`, `apparel`, `tattoos`.                                                                                                                                                                                                            |
| `startSection`     | string            | Section shown first.                                                                                                                                                                                                                                                                                    |
| `pricingProfile`   | string or `false` | A `Config.PricingProfiles` key, or `false` to charge nothing. The server takes the profile from its own session, so this is a request, not a price.                                                                                                                                                     |
| `allowCancel`      | boolean           | `false` = ESC never closes the menu.                                                                                                                                                                                                                                                                    |
| `allowSaving`      | boolean           | SAVE OUTFIT / UPDATE available.                                                                                                                                                                                                                                                                         |
| `allowSharing`     | boolean           | SHARE / SEND available.                                                                                                                                                                                                                                                                                 |
| `checkoutRequired` | boolean           | The main button goes through checkout.                                                                                                                                                                                                                                                                  |
| `free`             | boolean           | Every clothing item costs 0.                                                                                                                                                                                                                                                                            |
| `shopId`           | string            | A `Config.Shops` id. Its type supplies sections and pricing.                                                                                                                                                                                                                                            |
| `wardrobeId`       | string            | A `Config.Wardrobes` id (label, restrictions, distance check).                                                                                                                                                                                                                                          |
| `bagId`            | string            | Outfit bag to open.                                                                                                                                                                                                                                                                                     |
| `title`            | string            | Overrides the title shown in the menu.                                                                                                                                                                                                                                                                  |
| `categories`       | list              | Clothing categories to show, for example `{ "tops", "bottoms" }`.                                                                                                                                                                                                                                       |
| `cameraPreset`     | string            | First camera preset.                                                                                                                                                                                                                                                                                    |
| `freezePed`        | boolean           | Overrides `Config.PlayerState.freezePed` for this menu.                                                                                                                                                                                                                                                 |
| `startView`        | string            | `"root"`, `"wardrobe"` or `"grid"`.                                                                                                                                                                                                                                                                     |
| `startCategory`    | string            | Category opened when `startView = "grid"`.                                                                                                                                                                                                                                                              |
| `editOutfitId`     | integer           | Outfit to open for editing.                                                                                                                                                                                                                                                                             |

Sharing is always off when `Config.Sharing.enabled = false`.

## Server exports

For custom peds. They keep the contract of the exports of earlier illenium custom-ped scripts, so a resource written for those only needs the resource name changed.

| Export                                 | Arguments                                                                         | Returns                                 | What it does                     |
| -------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------- | -------------------------------- |
| `SetCustomPed(src, model, assignedBy)` | Server id, ped model, optional text saved as who assigned it (default `"export"`) | `true, model` or `false, message`       | Same as `/giveped <src> <model>` |
| `RemoveCustomPed(src)`                 | Server id                                                                         | `true, message` or `false, message`     | Same as `/giveped <src> reset`   |
| `GetCustomPed(src)`                    | Server id                                                                         | `{ model, components, props }` or `nil` | The character's assignment       |

`message` is a localized text you can show. Unlike `/giveped`, the exports notify nobody: report the result yourself. `SetCustomPed` and `RemoveCustomPed` wait for the target's client, so call them from a thread, an event or a command handler, never at file top level. They **don't check who is asking**: do your own permission check first.

```lua
-- server side of your resource
RegisterNetEvent("my_resource:server:becomeBusinessman", function()
    local src = source
    -- your own permission / job check here
    local ok, result = exports.Chapo_advanced_clothing:SetCustomPed(src, "a_m_m_business_01", "my_resource")
    if ok then
        print(("player %d is now %s"):format(src, result))
    else
        print(("could not give the ped: %s"):format(result))
    end
end)
```


---

# 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/exports.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.
