Docs/ORB Clothing/Events & Exports

Events & Exports

Client Export

lua
-- Apply a full appearance to any ped
-- Used by multichar, character select, and other scripts
exports['orb_clothing']:setPedAppearance(ped, data)

Parameters:

  • ped — The ped entity to apply appearance to
  • data — Table containing: appearance, hair, clothing, props, tattoos

Example:

lua
-- Load and apply appearance from database
local appearance = lib.callback.await('orb_clothing:server:loadAppearance', false)
if appearance then
    exports['orb_clothing']:setPedAppearance(PlayerPedId(), appearance)
end

Client Events

lua
-- Open the character creator with a store context
TriggerEvent('orb_clothing:client:openCreator', storeType)
-- storeType: 'clothing' | 'barber' | 'tattoo' | 'accessories'

-- Open the creator in first-time / new-character mode (used by multichar)
TriggerEvent('orb_clothing:client:openForNewCharacter')

-- Apply appearance directly to the player
TriggerEvent('orb_clothing:client:applyAppearance', appearanceData)

-- Fired by the server once an appearance has been saved
AddEventHandler('orb_clothing:client:creatorSaved', function()
    -- Appearance is saved to the database
end)

-- Close the creator
AddEventHandler('orb_clothing:client:close', function() end)

Server Events

lua
-- Save appearance (validated server-side)
TriggerServerEvent('orb_clothing:server:saveAppearance', data)

-- Enter isolated routing bucket for customization
TriggerServerEvent('orb_clothing:server:enterBucket')

-- Exit routing bucket, return to world
TriggerServerEvent('orb_clothing:server:exitBucket')

Server Callbacks (ox_lib)

lua
-- Load saved appearance for current player
-- Returns: table with appearance, hair, clothing, props, tattoos
lib.callback.register('orb_clothing:server:loadAppearance', function(source)
    -- Returns saved appearance or nil
end)

-- Get admin store list
-- Returns: table of admin-created stores
lib.callback.register('orb_clothing:server:getAdminStores', function(source)
    -- Returns admin stores from data/admin_stores.json
end)

Commands

CommandPermissionDescription
/storeadminAdminOpen the store admin panel
Players interact with stores by walking into a store zone and pressing **E** — no command needed. Customization is also opened programmatically (e.g. from multichar) via the events below.

Multichar Integration

To integrate with your multichar script:

lua
-- 1. Open the creator for a new character
TriggerEvent('orb_clothing:client:openForNewCharacter')

-- 2. Listen for the save confirmation
AddEventHandler('orb_clothing:client:creatorSaved', function()
    -- Player finished creating their character
    -- Appearance is already saved to the database
end)

-- 3. Apply the saved appearance on character select
local data = lib.callback.await('orb_clothing:server:loadAppearance', false)
exports['orb_clothing']:setPedAppearance(PlayerPedId(), data)