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#
- Open any clothing store or closet
- Customize your appearance
- Click the Save button
- Enter an outfit name
- 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#
- Open the outfit menu (
Hkey in shop zones or via command) - Select an outfit from your list
- 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#
- Open outfit management
- Select "Update Outfit"
- Choose the outfit to update
- 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#
- Open outfit management
- Select "Delete Outfit"
- Choose outfit(s) to delete
- 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:
- Open outfit menu
- Select "Import Outfit"
- Enter the 5-character code
- 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.luaShop.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.luaShop.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.luaShop.PersistUniforms = true
How It Works#
- Player equips job uniform
- System stores reference to current uniform
- On player spawn/reconnect, uniform is reapplied
- 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.luaShop.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#
- Check database connection
- Verify
player_outfitstable exists - Check console for errors
- Ensure player identifier is being retrieved
Job Outfit Not Appearing#
- Verify job name matches exactly
- Check player's job grade meets minimum
- Confirm zone coordinates are correct
- Verify outfit data format is correct
Share Code Not Working#
- Verify code is exactly 5 characters
- Check outfit exists in database
- Ensure outfit hasn't been deleted