SHOPPING CART

Onex

Command Palette

Search for a command to run...

CLIENT EXPORTS#

Client exports allow you to interact with onex-creation from other client-side scripts.

openCreationMenu#

Opens the creation menu with a specific shop type.

exports['onex-creation']:openCreationMenu(type, callback)

Parameters:

NameTypeDescription
typestringShop type: 'newchar', 'admin', 'clothes', 'barber', 'tattoos', 'family_edit'
callbackfunctionOptional callback when menu closes

Example:

Your Script
-- Open clothing store exports['onex-creation']:openCreationMenu('clothes', function(appearance) if appearance then print('Player saved their appearance') else print('Player cancelled') end end) -- Open full admin menu exports['onex-creation']:openCreationMenu('admin') -- Open barber shop exports['onex-creation']:openCreationMenu('barber')

Appearance Data#

FetchPlayerClothes#

Get the current player's appearance data.

local appearance = exports['onex-creation']:FetchPlayerClothes()

Returns: table - Current appearance in Schema v2 format

Example:

Your Script
local appearance = exports['onex-creation']:FetchPlayerClothes() print('Model:', appearance.model) print('Schema Version:', appearance.schema_version) -- Access components for id, component in pairs(appearance.components) do print(string.format('Component %s: %s/%d/%d', id, component.collection, component.localIndex, component.texture )) end

FetchCurretPlayerClothesFromDB#

Fetch the player's saved appearance from the database.

local appearance = exports['onex-creation']:FetchCurretPlayerClothesFromDB()

Returns: table - Saved appearance from database

Example:

Your Script
-- Get saved appearance(may differ from current if player made unsaved changes) local savedAppearance = exports['onex-creation']:FetchCurretPlayerClothesFromDB() if savedAppearance then print('Saved appearance found') else print('No saved appearance') end

FetchPlayerModel#

Get the current player's ped model.

local model = exports['onex-creation']:FetchPlayerModel()

Returns: string - Model name (e.g., 'mp_m_freemode_01')

Example:

Your Script
local model = exports['onex-creation']:FetchPlayerModel() if model == 'mp_m_freemode_01' then print('Player is using male freemode model') elseif model == 'mp_f_freemode_01' then print('Player is using female freemode model') else print('Player is using model: ' .. model) end

Ped Operations#

LoadPedModel#

Load a ped model on a specified ped.

exports['onex-creation']:LoadPedModel(ped, model)

Parameters:

NameTypeDescription
pednumberPed handle
modelstringModel name to load

Example:

Your Script
local ped = PlayerPedId() -- Change to female model exports['onex-creation']:LoadPedModel(ped, 'mp_f_freemode_01') -- Change to male model exports['onex-creation']:LoadPedModel(ped, 'mp_m_freemode_01') -- Change to specific ped exports['onex-creation']:LoadPedModel(ped, 's_m_y_cop_01')

LoadPedSkin#

Apply an appearance to a ped.

exports['onex-creation']:LoadPedSkin(skin, ped)

Parameters:

NameTypeDescription
skintableAppearance data (Schema v2)
pednumberOptional ped handle (defaults to player ped)

Example:

Your Script
-- Apply appearance to player local appearance = { schema_version = 2, model = 'mp_m_freemode_01', components = { ["11"] = { collection = "base", localIndex = 15, texture = 0 }, ["4"] = { collection = "base", localIndex = 21, texture = 0 }, ["6"] = { collection = "base", localIndex = 34, texture = 0 } } } exports['onex-creation']:LoadPedSkin(appearance) -- Apply to specific ped local npc = CreatePed(...) exports['onex-creation']:LoadPedSkin(appearance, npc)

loadCustomOutfit#

Load a custom outfit (like job uniforms).

exports['onex-creation']:loadCustomOutfit(skin, isPersistUniforms)

Parameters:

NameTypeDescription
skintableOutfit data
isPersistUniformsbooleanWhether to persist across sessions

Example:

Your Script
-- Load job uniform(persists) local policeUniform = { torso = { collection = "base", localIndex = 55, texture = 0 }, pants = { collection = "base", localIndex = 25, texture = 0 }, shoes = { collection = "base", localIndex = 10, texture = 0 } } exports['onex-creation']:loadCustomOutfit(policeUniform, true) -- Load temporary outfit(doesn't persist) exports['onex-creation']:loadCustomOutfit(casualOutfit, false)

Appearance Management#

ApplyAppearance#

Apply a complete appearance to the player.

exports['onex-creation']:ApplyAppearance(appearance)

Parameters:

NameTypeDescription
appearancetableFull appearance data

Example:

Your Script
local fullAppearance = { schema_version = 2, model = 'mp_m_freemode_01', headBlend = { shapeFirst = 5, shapeSecond = 10, shapeMix = 0.5, skinFirst = 5, skinSecond = 10, skinMix = 0.5 }, components = { ... }, props = { ... }, faceFeatures = { ... }, overlays = { ... }, hair = { color = 5, highlight = 0 }, eyeColor = 3 } exports['onex-creation']:ApplyAppearance(fullAppearance)

UpdateComponent#

Update a single component of the appearance.

local updated = exports['onex-creation']:UpdateComponent(componentKey, field, value, currentAppearance)

Parameters:

NameTypeDescription
componentKeystringComponent key (e.g., 'torso', 'pants')
fieldstringField to update ('collection', 'localIndex', 'texture')
valueanyNew value
currentAppearancetableCurrent appearance data

Returns: table - Updated appearance

Example:

Your Script
local appearance = exports['onex-creation']:FetchPlayerClothes() -- Change torso texture local updated = exports['onex-creation']:UpdateComponent( 'torso', 'texture', 5, appearance ) exports['onex-creation']:ApplyAppearance(updated)

Preview Images#

getClothesPreview#

Get the preview image URL for a clothing item.

local url = exports['onex-creation']:getClothesPreview(type, component, item)

Parameters:

NameTypeDescription
typestringGender: 'male' or 'female'
componentstringComponent category
itemnumberItem index

Returns: string - URL to preview image

Example:

Your Script
local previewUrl = exports['onex-creation']:getClothesPreview('male', 'torso', 15) print('Preview URL:', previewUrl)

Format Detection#

DetectFormat#

Detect the format of appearance data.

local format = exports['onex-creation']:DetectFormat(data)

Parameters:

NameTypeDescription
datatableAppearance data

Returns: string - Format type: 'schema_v2', 'qb-clothing', 'esx_skin', etc.

Example:

Your Script
local oldData = { pants_1 = 10, pants_2 = 0 } local format = exports['onex-creation']:DetectFormat(oldData) print('Detected format:', format) -- 'esx_skin'

LoadPedAppearance#

Auto-detect format and load appearance.

exports['onex-creation']:LoadPedAppearance(data, ped)

Parameters:

NameTypeDescription
datatableAppearance data (any supported format)
pednumberOptional ped handle

Example:

Your Script
-- Works with any format - auto-detects and converts local legacyData = { pants_1 = 10, shoes_1 = 34 } exports['onex-creation']:LoadPedAppearance(legacyData)

ChangeVariation#

Change a variation on the current appearance.

exports['onex-creation']:ChangeVariation(data, currentAppearance)

Parameters:

NameTypeDescription
datatableVariation data
currentAppearancetableCurrent appearance

Collection Detection#

DetectComponent#

Detect the collection for a component.

local info = exports['onex-creation']:DetectComponent(ped, componentId, drawableId, textureId)

Parameters:

NameTypeDescription
pednumberPed handle
componentIdnumberComponent ID (0-11)
drawableIdnumberDrawable index
textureIdnumberTexture index

Returns: table - Collection info { collection, localIndex, texture }

Example:

Your Script
local ped = PlayerPedId() local torsoDrawable = GetPedDrawableVariation(ped, 11) local torsoTexture = GetPedTextureVariation(ped, 11) local info = exports['onex-creation']:DetectComponent(ped, 11, torsoDrawable, torsoTexture) print('Collection:', info.collection) print('Local Index:', info.localIndex)

DetectProp#

Detect the collection for a prop.

local info = exports['onex-creation']:DetectProp(ped, propId, drawableId, textureId)

Parameters:

NameTypeDescription
pednumberPed handle
propIdnumberProp ID (0, 1, 2, 6, 7)
drawableIdnumberDrawable index
textureIdnumberTexture index

Returns: table - Collection info

Example:

Your Script
local ped = PlayerPedId() local hatDrawable = GetPedPropIndex(ped, 0) local hatTexture = GetPedPropTextureIndex(ped, 0) local info = exports['onex-creation']:DetectProp(ped, 0, hatDrawable, hatTexture) print('Hat collection:', info.collection)

Next Steps#