Integrations
Framework, inventory, job gates, and skill hooks. Edit client/edit.lua and server/edit.lua.
Framework and inventory are detected in shared/utils.lua. Function hooks live in client/edit.lua and server/edit.lua. Do not rename those globals. The core calls them by name.
Config.Framework = "auto" -- qbcore, qbox, esx, or custom
Config.Inventory = "auto" -- ox_inventory, or custom"auto" framework order: qb-core → qbx_core → es_extended. If none are started, it falls back to "custom".
"auto" inventory uses ox_inventory when that resource is started, otherwise the framework inventory.
Config.Framework = "custom" skips the built-in core object. Config.Inventory = "custom" skips ox and the framework inventory. Fill every custom branch you need in server/edit.lua.
Job gates
-- server/edit.lua
function CanUseDetector(src, player, item)
return true
end
function CanUseBattery(src, player, item)
return true
end
-- client/edit.lua
function CanStartScan()
if cache.vehicle then
return false, locale('error.in_vehicle')
end
if IsPlayerDown() then
return false
end
return true
endReturn false to block. Optional second return is an error notify string.
Job and skill details, including a worked GetSkillProfile example: server/edit.lua. Client death and start gates: client/edit.lua.
Skill / XP
GetSkillProfile runs on start, identify, collect, drain, and cooldown checks.
function GetSkillProfile(source, player, context)
return {
scanClarityBonus = 0.0, -- 0.2 = +20% scan range
drainMultiplier = 1.0, -- 0.8 = 20% less drain
digCooldownMs = nil, -- nil = Config.Scan.digCooldownMs
lootWeightMultipliers = nil, -- optional per Config.Loot.bands key
}
end
function OnSkillProgress(source, player, result)
-- result.item, result.count, result.rare, result.siteId, result.detectorItem
endUse OnSkillProgress to add framework skill, reputation, or XP after a successful find.
State bag
Replicated session:
- Unequipped:
Player(src).state.gs_metaldetect/LocalPlayer.state.gs_metaldetectisfalse - Scanning:
{ item, slot, charge }
Client hooks OnScanStarted / OnScanStopped and server hooks OnDetectorEquipped / OnDetectorUnequipped fire around that state.
Death / down
RegisterDownHooks in client/edit.lua unequips on ESX death, baseevents, hospital laststand, and fatal damage. Add your ambulance event next to the commented example.
Custom inventory
Fill these in server/edit.lua when Config.Inventory = "custom":
GetSlotItem,GetSlotsWithItem,SetItemMetadataRemoveItem,CanCarryItem,AddItemCreateUsableItem(whenConfig.Framework = "custom")
Slot items need .name, .slot, and .metadata or .info (charge lives there).
