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.cfgensure 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 - ServerAddEventHandler('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 - ClientRegisterNetEvent('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.luaConfig.UitilityCommands = { admin_creation = { active = true, command = 'acreation' }, Refreshskin = { active = true, command = 'refreshskin' } }
Admin Command#
For admin commands without ACE permissions:
Your Script - ServerRegisterCommand('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.luaShop.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.luaFramework.Notify = { name = 'onex-interaction' -- Uses onex-interaction }
Or use ox_lib notifications:
Your Scriptlib.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#
- Check database table exists
- Verify identifier is being retrieved
- Check oxmysql is running
- Enable debug mode
No Money Integration#
- Set
everythingFree = truein pricing config - Or implement CustomFx money functions
Jobs Not Working#
- Implement CustomFx.Server.GetJob
- Or disable job-related features