SHOPPING CART

Onex

Command Palette

Search for a command to run...

STANDALONE MODE#

onex-creation can run in standalone mode without QBCore or ESX, using its own database system for appearance storage.

Overview#

Standalone mode:

  • Uses onex-creation's own file/database system
  • No framework dependency for core functionality
  • Full feature parity with framework versions

Requirements#

server.cfg
ensure ox_lib ensure onex-base ensure onex-interaction ensure onex-creation

Player Identification#

In standalone mode, players are identified by their license:

Standalone Mode
-- Get player identifier local function GetPlayerIdentifier(source) for _, id in ipairs(GetPlayerIdentifiers(source)) do if string.match(id, 'license:') then return id end end return nil end

Triggering Character Creation#

Without a framework's character system, trigger creation manually:

On First Join#

Your Script - Server
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals) local source = source local identifier = GetPlayerIdentifier(source, 0) -- Check if player has appearance local result = MySQL.query.await('SELECT appearance FROM onex_player_appearance WHERE identifier = ?', {identifier}) if not result or #result == 0 then -- Flag as new player TriggerClientEvent('onex:newPlayer', source) end end)
Your Script - Client
RegisterNetEvent('onex:newPlayer') AddEventHandler('onex:newPlayer', function() -- Open character creation exports['onex-creation']:openCreationMenu('newchar', function(appearance) print('Character created!') end) end)

On Spawn#

Your Script - Client
-- Load appearance on spawn AddEventHandler('playerSpawned', function() -- Fetch and apply saved appearance local appearance = exports['onex-creation']:FetchCurretPlayerClothesFromDB() if appearance then exports['onex-creation']:LoadPedSkin(appearance) end end)

Using Commands#

Enable utility commands for standalone:

config/main.lua
Config.UitilityCommands = { admin_creation = { active = true, command = 'acreation' }, Refreshskin = { active = true, command = 'refreshskin' } }

Admin Command#

For admin commands without ACE permissions:

Your Script - Server
RegisterCommand('acreation', function(source, args, rawCommand) local identifier = GetPlayerIdentifier(source, 0) -- Your admin check if IsPlayerAdmin(identifier) then TriggerClientEvent('onex-creation:client:openCreationMenu', source, 'admin') end end, false)

Job System Integration#

Without a framework job system, implement your own:

config/shop.lua
Shop.JobOutfits = { ["police"] = { label = "Police", outfits = { { label = "Patrol Uniform", minGrade = 0, outfit = { ... } } } } }
integrations/custom_framework/server.lua
-- Implement job check CustomFx.Server.GetJob = function(source) local identifier = GetPlayerIdentifier(source, 0) -- Your job lookup logic local result = MySQL.query.await('SELECT job, grade FROM player_jobs WHERE identifier = ?', {identifier}) if result and result[1] then return { name = result[1].job, grade = result[1].grade } end return { name = 'unemployed', grade = 0 } end

Notifications#

Configure standalone notifications:

modules/framework/shared/framework.lua
Framework.Notify = { name = 'onex-interaction' -- Uses onex-interaction }

Or use ox_lib notifications:

Your Script
lib.notify({ title = 'Clothing', description = 'Outfit saved!', type = 'success' })

Full Standalone Example#

Complete standalone integration:

Your Standalone Script
-- server.lua local function GetIdentifier(source) for _, id in ipairs(GetPlayerIdentifiers(source)) do if string.match(id, 'license:') then return id end end end RegisterNetEvent('standalone:playerLoaded') AddEventHandler('standalone:playerLoaded', function() local source = source local identifier = GetIdentifier(source) -- Load appearance local result = MySQL.query.await( 'SELECT appearance FROM onex_player_appearance WHERE identifier = ?', {identifier} ) if result and result[1] then TriggerClientEvent('onex-creation:client:loadPedSkin', source, json.decode(result[1].appearance)) else -- New player - create character TriggerClientEvent('onex-creation:client:CreateNewChar', source) end end)
client.lua
-- Trigger on spawn CreateThread(function() while true do Wait(0) if NetworkIsPlayerActive(PlayerId()) then TriggerServerEvent('standalone:playerLoaded') break end end end)

Troubleshooting#

Appearance Not Persisting#

  1. Check database table exists
  2. Verify identifier is being retrieved
  3. Check oxmysql is running
  4. Enable debug mode

No Money Integration#

  1. Set everythingFree = true in pricing config
  2. Or implement CustomFx money functions

Jobs Not Working#

  1. Implement CustomFx.Server.GetJob
  2. Or disable job-related features

Next Steps#