Server Edit
Updated 4/28/2026
Server Edit
🔧 Framework Validation & Core Setup
Before executing any logic, the module validates the configured framework and ensures qb-core is running.
if not Config.Framework
or (Config.Framework:lower() ~= 'qbcore' and Config.Framework:lower() ~= 'qbox') then
return
end
if GetResourceState('qb-core') ~= 'started' then return end
local QBCore = exports['qb-core']:GetCoreObject()
local hasDonePreloading = {}
📡 Event Handlers
Tracks preloading state, isolates players in routing buckets, and resets data on logout.
AddEventHandler('QBCore:Server:PlayerLoaded', function(Player)
Wait(100)
if Player and Player.PlayerData then
hasDonePreloading[Player.PlayerData.source] = true
end
end)
AddEventHandler('QBCore:Server:OnPlayerUnload', function(src)
hasDonePreloading[src] = false
end)
AddEventHandler('playerJoining', function()
SetPlayerRoutingBucket(source, source)
end)
🧰 Utility Functions
Logging
Unified logging supporting qb-log if available.
Customize.Log(category, title, color, message)
Falls back to print if qb-log is not started.
Database & Framework Access
Customize.GetDBInfo() -- Returns table, identifier, charinfo
Customize.GetFramework() -- Returns QBCore object
Customize.RegisterCallback(name, handler)
Customize.RefreshCommands(src)
👤 Player Login Logic
Handles login when a player selects a character.
Customize.Login(src, citizenid, newData)
Features:
- Resets preloading flags
- Performs standard QBCore login
- Moves player back to main world routing bucket
- Refreshes commands/permissions
- Returns
trueif successful,falseotherwise
🎒 Inventory & Starter Items
Supports adding items to player inventories with multiple systems.
Customize.AddItem(src, item, amount, metadata, tag)
Customize.GetStarterItems()
- Supports
ox_inventoryandqb-inventory - Falls back gracefully if neither is available
🏠 Housing & Apartments
Handles fetching house data and giving starting apartments.
Customize.LoadHouseData(src)
Customize.GiveStartingApartment(src, newData)
- Supports
qb-housesandqb-apartments - Decodes coordinates and garage data
- Places players in unique routing buckets if necessary
🎭 Appearance / Skin Handling
Fetches saved skins and resolves fallback ped models.
Customize.FetchSkinFromDB(identifier)
- Decodes JSON stored in
playerskinstable - Determines model based on gender/sex if missing
- Returns
modelandskinDatatable
⚙ Admin Commands
/logout
Logs the player out and returns to the character selection screen.
QBCore.Commands.Add('logout', ...)
/delchar
Force deletes a player's character using server ID.
QBCore.Commands.Add('delchar', ...)
Client Delete Event
RegisterNetEvent('ks-multicharacter:server:deleteCharacter', function(citizenid)
QBCore.Player.DeleteCharacter(source, citizenid)
end)
📦 Module Export
The module returns the Customize table:
return Customize
All functions are designed to be framework-agnostic where possible, supporting QBCore, QBox, and various inventory and appearance systems.
✅ Notes
- Ensure
qb-coreis fully started before loading this module - Routing buckets isolate players during character selection/login
- Supports fallback mechanisms for inventory, appearance, and housing
- Admin commands integrate with QBCore command system for convenience