# Exports & Commands

Every upstream illenium-appearance export, event and command keeps working.
This page lists what the redesign adds and the upstream API you are most likely to call.

Replace `illenium-appearance` with your folder name if you renamed it.

## New exports

### getClothingImage

Client and server. Returns the image URL of an item: the Fivemanage URL when there is one, otherwise the file in `shots/`.

```lua
local url = exports['illenium-appearance']:getClothingImage(gender, category, drawable, texture)
```

| Argument | Type | Description |
| --- | --- | --- |
| `gender` | `"male"` \| `"female"` | Image set |
| `category` | string | Category key, see below |
| `drawable` | number | Drawable id |
| `texture` | number? | Texture id. Used when the category is captured **With textures** |

Returns `nil` for an invalid gender or drawable. The URL does not tell you whether the image exists.

### getClothingMeta

Server. Returns the metadata used for clothing items — use it to give clothing in any inventory.

```lua
local meta = exports['illenium-appearance']:getClothingMeta('male', 'jackets', 4, 0)
```

```lua title="Returns"
{
    label = "Street Jacket",   -- name from the Capture panel, or "Jackets #4"
    imageurl = "https://...",
    gender = "male",
    category = "jackets",
    kind = "component",        -- "component" | "prop"
    id = 11,                   -- component / prop id
    drawable = 4,
    texture = 0,
    description = "Jackets - M 4 / 0",
}
```

Returns `nil` for an unknown category or drawable.

### useClothing

Client. The ox_inventory handler of the clothing item (`client = { export = 'illenium-appearance.useClothing' }`). You do not call it yourself.

### updateMaskFix

Client. Runs the mask clipping check on a ped right now. Useful after you change a mask on a ped without the appearance exports.

```lua
exports['illenium-appearance']:updateMaskFix(ped) -- ped defaults to the player
```

## Category keys

| Key | Kind | Id |
| --- | --- | --- |
| `masks` | component | 1 |
| `hair` | hair | 2 |
| `arms` | component | 3 |
| `pants` | component | 4 |
| `bags` | component | 5 |
| `shoes` | component | 6 |
| `accessories` | component | 7 |
| `undershirts` | component | 8 |
| `vests` | component | 9 |
| `decals` | component | 10 |
| `jackets` | component | 11 |
| `hats` | prop | 0 |
| `glasses` | prop | 1 |
| `ears` | prop | 2 |
| `watches` | prop | 6 |
| `bracelets` | prop | 7 |
| `beard` | overlay | 1 |

Tattoo zones use `tattoo_torso`, `tattoo_head`, `tattoo_left_arm`, `tattoo_right_arm`, `tattoo_left_leg` and `tattoo_right_leg`.

## Upstream exports

All client exports of illenium-appearance are unchanged:

`startPlayerCustomization`, `getPedModel`, `getPedComponents`, `getPedProps`, `getPedHeadBlend`, `getPedFaceFeatures`, `getPedHeadOverlays`, `getPedHair`, `getPedAppearance`, `setPlayerModel`, `setPedHeadBlend`, `setPedFaceFeatures`, `setPedHeadOverlays`, `setPedHair`, `setPedEyeColor`, `setPedComponent`, `setPedComponents`, `setPedProp`, `setPedProps`, `setPlayerAppearance`, `setPedAppearance`, `setPedTattoos`.

```lua title="Open the editor from your own script"
exports['illenium-appearance']:startPlayerCustomization(function(appearance)
    if appearance then
        TriggerServerEvent('illenium-appearance:server:saveAppearance', appearance)
    end
end, {
    ped = true, headBlend = true, faceFeatures = true, headOverlays = true,
    components = true, props = true, tattoos = true,
})
```

## Commands

| Command | Who | What it does |
| --- | --- | --- |
| `/pedmenu [id]` | Admin | Opens the full character creator for you or player `id`. Needs `Config.EnablePedMenu` |
| `/skin [id]` | Admin | Same as `/pedmenu`. More names in `Config.Koja.SkinCommands` |
| `/shopped [type]` | Admin | Copies a shopkeeper config line for where you stand. `type` = `clothing`, `barber`, `tattoo` or `surgeon` |
| `/reloadskin` | Everyone | Reloads your saved skin (cooldown `Config.ReloadSkinCooldown`) |
| `/clearstuckprops` | Everyone | Removes props stuck to your ped |
| `/joboutfits` | Everyone | Job outfits. Needs `Config.EnableJobOutfitsCommand` |
| `/gangoutfits` | Everyone | Gang outfits. Needs `Config.EnableJobOutfitsCommand` |
| `/bossmanagedoutfits` | Boss | ESX: manage job outfits. Needs `Config.BossManagedOutfits` |
| `/migrateskins` | Console / admin | ESX: converts every old esx_skin skin again. QBCore: `/migrateskins [resourceName]` imports from qb-clothing (`group.god`) |

"Admin" means the ace in `Config.Koja.Capture.AdminGroup` or a group from `Config.Koja.Capture.FrameworkGroups`.

## Client events you can trigger

These upstream events open the menus. With the wardrobe hub on, they open the hub.

| Event | Opens |
| --- | --- |
| `illenium-appearance:client:openClothingShopMenu` | Clothing shop (pass `true` for the full creator) |
| `illenium-appearance:client:OpenBarberShop` | Barber shop |
| `illenium-appearance:client:OpenTattooShop` | Tattoo shop |
| `illenium-appearance:client:OpenSurgeonShop` | Plastic surgeon |
| `illenium-appearance:client:openOutfitMenu` | Player outfits |
| `illenium-appearance:client:openJobOutfitsMenu` | Job outfits |
| `illenium-appearance:client:OutfitManagementMenu` | Boss / gang outfit management |
| `illenium-appearance:client:reloadSkin` | Reloads the saved skin |
| `illenium-appearance:client:ClearStuckProps` | Clears stuck props |

```lua title="Server side"
TriggerClientEvent('illenium-appearance:client:OpenBarberShop', source)
```

## Events the resource sends

| Event | Side | When |
| --- | --- | --- |
| `koja-appearance:client:catalogChanged` | Client | An admin changed an image, name, price or capture setting. The menu refetches the catalog |
