SHOPPING CART

Onex

Command Palette

Search for a command to run...

OUTFIT SYSTEM#

The outfit system allows players to save, manage, share, and quickly switch between different clothing combinations.

Overview#

Key features:

  • Save unlimited outfits
  • Update existing outfits
  • Delete unwanted outfits
  • Share outfits via codes
  • Import outfits from other players
  • Job-specific uniforms

Saving Outfits#

Via Menu#

  1. Open any clothing store or closet
  2. Customize your appearance
  3. Click the Save button
  4. Enter an outfit name
  5. Optionally add a description

Via Script#

Your Script
-- Save current appearance as outfit TriggerServerEvent('onex-creation:server:saveOutfits', 'My Casual Look', -- Outfit name 'Weekend outfit', -- Description(optional) exports['onex-creation']:FetchPlayerClothes() -- Appearance data )

Loading Outfits#

Via Menu#

  1. Open the outfit menu (H key in shop zones or via command)
  2. Select an outfit from your list
  3. Click to apply

Via Script#

Your Script
-- Get player outfits local outfits = lib.callback.await('onex_creation:fetchOutfit', false) -- Load first outfit if outfits and #outfits > 0 then exports['onex-creation']:loadCustomOutfit(json.decode(outfits[1].skin), false) end

Updating Outfits#

To update an existing outfit with your current appearance:

Via Menu#

  1. Open outfit management
  2. Select "Update Outfit"
  3. Choose the outfit to update
  4. Confirm the update

Via Script#

Your Script
-- Update outfit by ID local newAppearance = exports['onex-creation']:FetchPlayerClothes() TriggerServerEvent('onex-creation:server:UpdateOutfitdata', outfitId, newAppearance)

Deleting Outfits#

Via Menu#

  1. Open outfit management
  2. Select "Delete Outfit"
  3. Choose outfit(s) to delete
  4. Confirm deletion

Via Script#

Your Script
-- Delete outfit by ID TriggerServerEvent('onex-creation:client:DeleteOutfit', outfitId)

Outfit Sharing#

Each saved outfit gets a unique 5-character share code.

Getting Your Code#

Your Script
-- Outfits include the share code local outfits = lib.callback.await('onex_creation:fetchOutfit', false) for _, outfit in ipairs(outfits) do print(string.format('%s - Code: %s', outfit.outfitname, outfit.code)) end

Importing Shared Outfits#

Via Menu:

  1. Open outfit menu
  2. Select "Import Outfit"
  3. Enter the 5-character code
  4. Outfit is added to your collection

Via Script:

Your Script
-- Import outfit by code TriggerServerEvent('onex-creation:server:importOutfit', 'ABC12')

Job Outfits#

Configuration#

Job outfits are configured in config/shop.lua:

config/shop.lua
Shop.JobOutfits = { ["police"] = { label = "Police Department", outfits = { { label = "Patrol Uniform", minGrade = 0, outfit = { torso = { collection = "base", localIndex = 55, texture = 0 }, pants = { collection = "base", localIndex = 25, texture = 0 }, shoes = { collection = "base", localIndex = 10, texture = 0 }, hat = { collection = "base", localIndex = 45, texture = 0 } } }, { label = "Detective", minGrade = 3, outfit = { torso = { collection = "base", localIndex = 4, texture = 1 }, pants = { collection = "base", localIndex = 10, texture = 0 }, shoes = { collection = "base", localIndex = 10, texture = 1 } } }, { label = "SWAT", minGrade = 5, outfit = { torso = { collection = "base", localIndex = 15, texture = 0 }, vest = { collection = "base", localIndex = 12, texture = 0 }, pants = { collection = "base", localIndex = 30, texture = 0 }, hat = { collection = "base", localIndex = 117, texture = 0 } } } } } }

Opening Job Outfit Menu#

Your Script
-- Open job outfit selection TriggerEvent('onex-creation:client:JobOutifit', 'police')

Job Outfit Zones#

Configure where job outfits can be accessed:

config/shop.lua
Shop.JobOutfitCfg = { ["police"] = { zones = { { coords = vector3(461.8, -1001.0, 24.9), size = vector3(3.0, 3.0, 2.0), label = "LSPD Locker Room" }, { coords = vector3(1853.0, 3686.0, 34.2), size = vector3(3.0, 3.0, 2.0), label = "Sandy Shores PD Locker" } } } }

Outfit Persistence#

Enable Persistence#

When enabled, job uniforms persist across reconnects:

config/shop.lua
Shop.PersistUniforms = true

How It Works#

  1. Player equips job uniform
  2. System stores reference to current uniform
  3. On player spawn/reconnect, uniform is reapplied
  4. Continues until player manually changes clothes

Outfit Data Structure#

Outfits are stored with this structure:

{ id = 1, -- Database ID identifier = "license:abc123", -- Player identifier outfitname = "My Outfit", -- Display name description = "For weekends", -- Optional description skin = { -- Appearance data(JSON string in DB) schema_version = 2, components = { ["11"] = { collection = "base", localIndex = 15, texture = 0 }, ["4"] = { collection = "base", localIndex = 21, texture = 0 }, -- ... }, props = { ["0"] = { collection = "base", localIndex = 5, texture = 0 } } }, code = "ABC12" -- Share code }

What Gets Saved#

Components saved in outfits are configured in:

config/shop.lua
Shop.SaveOutfit_Things = { "face_skin", "mask", "hair", "arms", "pants", "bag", "shoes", "accessory", "shirt", "vest", "decals", "torso", "hat", "glass", "ear", "watch", "bracelet" }

Face features, overlays, and tattoos are NOT saved with outfits by default. Outfits only store clothing components and props.

Integration Examples#

Auto-Uniform on Job Start#

Your Script
-- QBCore example RegisterNetEvent('QBCore:Client:OnJobUpdate') AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo) if JobInfo.onduty then -- Open job outfit selection when going on duty TriggerEvent('onex-creation:client:JobOutifit', JobInfo.name) else -- Restore civilian clothes when going off duty TriggerEvent('onex-creation:client:syncClothes') end end)

Inventory Outfit Item#

Server Script
-- Create outfit item local function CreateOutfitItem(source, outfitData) local item = { name = 'outfit_bag', info = { outfit = json.encode(outfitData), label = outfitData.name or 'Saved Outfit' } } -- Add to player inventory exports['qb-inventory']:AddItem(source, item.name, 1, nil, item.info) end
Client Script
-- Use outfit from inventory RegisterNetEvent('outfit:use') AddEventHandler('outfit:use', function(itemData) local outfit = json.decode(itemData.info.outfit) exports['onex-creation']:loadCustomOutfit(outfit, false) end)

Quick Outfit Wheel#

Client Script
-- Create quick outfit selection local function OpenOutfitWheel() local outfits = lib.callback.await('onex_creation:fetchOutfit', false) local options = {} for _, outfit in ipairs(outfits) do table.insert(options, { label = outfit.outfitname, description = outfit.description, onSelect = function() exports['onex-creation']:loadCustomOutfit( json.decode(outfit.skin), false ) end }) end lib.registerContext({ id = 'outfit_wheel', title = 'Quick Outfit Change', options = options }) lib.showContext('outfit_wheel') end RegisterCommand('outfits', OpenOutfitWheel, false)

Troubleshooting#

Outfit Not Saving#

  1. Check database connection
  2. Verify player_outfits table exists
  3. Check console for errors
  4. Ensure player identifier is being retrieved

Job Outfit Not Appearing#

  1. Verify job name matches exactly
  2. Check player's job grade meets minimum
  3. Confirm zone coordinates are correct
  4. Verify outfit data format is correct

Share Code Not Working#

  1. Verify code is exactly 5 characters
  2. Check outfit exists in database
  3. Ensure outfit hasn't been deleted

Next Steps#