Command Palette
Search for a command to run...
CLIENT EXPORTS#
Client exports allow you to interact with onex-creation from other client-side scripts.
Menu Operations#
openCreationMenu#
Opens the creation menu with a specific shop type.
exports['onex-creation']:openCreationMenu(type, callback)
Parameters:
| Name | Type | Description |
|---|---|---|
type | string | Shop type: 'newchar', 'admin', 'clothes', 'barber', 'tattoos', 'family_edit' |
callback | function | Optional 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 Scriptlocal 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 Scriptlocal 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:
| Name | Type | Description |
|---|---|---|
ped | number | Ped handle |
model | string | Model name to load |
Example:
Your Scriptlocal 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:
| Name | Type | Description |
|---|---|---|
skin | table | Appearance data (Schema v2) |
ped | number | Optional 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:
| Name | Type | Description |
|---|---|---|
skin | table | Outfit data |
isPersistUniforms | boolean | Whether 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:
| Name | Type | Description |
|---|---|---|
appearance | table | Full appearance data |
Example:
Your Scriptlocal 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:
| Name | Type | Description |
|---|---|---|
componentKey | string | Component key (e.g., 'torso', 'pants') |
field | string | Field to update ('collection', 'localIndex', 'texture') |
value | any | New value |
currentAppearance | table | Current appearance data |
Returns: table - Updated appearance
Example:
Your Scriptlocal 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:
| Name | Type | Description |
|---|---|---|
type | string | Gender: 'male' or 'female' |
component | string | Component category |
item | number | Item index |
Returns: string - URL to preview image
Example:
Your Scriptlocal 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:
| Name | Type | Description |
|---|---|---|
data | table | Appearance data |
Returns: string - Format type: 'schema_v2', 'qb-clothing', 'esx_skin', etc.
Example:
Your Scriptlocal 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:
| Name | Type | Description |
|---|---|---|
data | table | Appearance data (any supported format) |
ped | number | Optional 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:
| Name | Type | Description |
|---|---|---|
data | table | Variation data |
currentAppearance | table | Current appearance |
Collection Detection#
DetectComponent#
Detect the collection for a component.
local info = exports['onex-creation']:DetectComponent(ped, componentId, drawableId, textureId)
Parameters:
| Name | Type | Description |
|---|---|---|
ped | number | Ped handle |
componentId | number | Component ID (0-11) |
drawableId | number | Drawable index |
textureId | number | Texture index |
Returns: table - Collection info { collection, localIndex, texture }
Example:
Your Scriptlocal 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:
| Name | Type | Description |
|---|---|---|
ped | number | Ped handle |
propId | number | Prop ID (0, 1, 2, 6, 7) |
drawableId | number | Drawable index |
textureId | number | Texture index |
Returns: table - Collection info
Example:
Your Scriptlocal 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)