> For the complete documentation index, see [llms.txt](https://docs.otherplanet.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otherplanet.dev/scripts/op-clothing/exports-events/client-side.md).

# Client Side

## Exports & Events

{% hint style="warning" %}
If you're looking for other data than listed here - feel free to contact us on our [Discord Server](https://discord.gg/otherplanet)!
{% endhint %}

These are the native **op-clothing** exports and events. The optional `ped` argument defaults to the local player when omitted.

### OpenClothingShop

Opens a clothing shop by id.

```lua
exports['op-clothing']:OpenClothingShop(shopId)
```

***

### OpenBarber

Opens a barber shop by id (alias: `OpenBarberShop`).

```lua
exports['op-clothing']:OpenBarber(shopId)
```

***

### OpenTattooShop

Opens a tattoo shop by id.

```lua
exports['op-clothing']:OpenTattooShop(shopId)
```

***

### OpenCharacterCreator

Opens the character creator. `opts` is optional.

```lua
exports['op-clothing']:OpenCharacterCreator({
    allowCancel = true,
    allowModelChange = true,
    onComplete = function(appearance)
        print('character created')
    end,
})
```

***

### OpenWardrobe

Opens the free wardrobe (owned outfits + full catalog, no prices). `opts` is optional.

```lua
exports['op-clothing']:OpenWardrobe()
```

***

### GetAppearance

Returns the ped's full appearance table.

```lua
local appearance = exports['op-clothing']:GetAppearance()
```

***

### SetAppearance

Applies a full appearance table to the ped.

```lua
exports['op-clothing']:SetAppearance(appearance)
```

***

### SetPedSkin

Applies a full appearance table (ped-first argument).

```lua
exports['op-clothing']:SetPedSkin(ped, appearance)
```

***

### SetClothing

Applies only the clothing part of an appearance, keeping the face/hair.

```lua
exports['op-clothing']:SetClothing(appearance)
```

***

### GetPlayerClothing

Returns a clothing-only payload (components + props), re-applicable through `ApplyOutfit`.

```lua
local outfit = exports['op-clothing']:GetPlayerClothing()
```

***

### SetPlayerClothing

Merges a clothing-only payload onto the ped's current look.

```lua
exports['op-clothing']:SetPlayerClothing(clothing)
```

***

### ApplyOutfit

Merges an outfit onto the ped's current look (keeps face, hair, heritage).

```lua
exports['op-clothing']:ApplyOutfit(outfit)
```

***

### SaveAppearance

Persists the ped's current look to the database.

```lua
exports['op-clothing']:SaveAppearance()
```

***

### ReloadAppearance

Re-pulls the saved look from the server and re-applies it (re-attaches tattoos/decorations).

```lua
exports['op-clothing']:ReloadAppearance()
```

***

### IsMenuOpen

Returns a `boolean` - whether any op-clothing menu is currently open.

```lua
local isOpen = exports['op-clothing']:IsMenuOpen()
```

***

### OpenJobLocker

Opens a job locker by its id.

```lua
exports['op-clothing']:OpenJobLocker(lockerId)
```

***

### OpenJobLockerByJob

Opens the nearest accessible locker for the given job. Returns a `boolean`.

```lua
local opened = exports['op-clothing']:OpenJobLockerByJob('police')
```

***

## Client Events

### op-clothing:client:menuOpened

Fired whenever any clothing/barber/tattoo/creator menu becomes visible.

```lua
AddEventHandler('op-clothing:client:menuOpened', function(data)
    -- data = { mode, shopId, free }
end)
```

***

### op-clothing:client:menuClosed

Fired whenever the menu is dismissed (confirm or cancel).

```lua
AddEventHandler('op-clothing:client:menuClosed', function(data)
    -- data = { mode }
end)
```

***

### op-clothing:client:appearanceLoaded

Fired after the saved look is (re)applied on spawn or `ReloadAppearance`.

```lua
AddEventHandler('op-clothing:client:appearanceLoaded', function(appearance)
    -- Your Code
end)
```

***

### op-clothing:client:characterCreated

Fired after the character creator finishes.

```lua
AddEventHandler('op-clothing:client:characterCreated', function(appearance)
    -- Your Code
end)
```

***

### op-clothing:client:purchased

Fired after a successful clothing purchase.

```lua
AddEventHandler('op-clothing:client:purchased', function(data)
    -- data = { shopId, price }
end)
```

***

### Triggerable client events

Drive op-clothing from another resource without grabbing the export reference.

```lua
TriggerEvent('op-clothing:client:openShop', shopId)
TriggerEvent('op-clothing:client:openWardrobe', opts)
TriggerEvent('op-clothing:client:openCharacterCreator', opts)
TriggerEvent('op-clothing:client:openJobLocker', lockerIdOrJob)
TriggerEvent('op-clothing:client:reloadAppearance')
TriggerEvent('op-clothing:client:saveAppearance')
```
