server/edit.lua
Owner-editable server hook: OpenTrailerInventory.
Do not rename this global. Core server code calls it by name.
Inventory auto-detect: Integrations.
OpenTrailerInventory
The client asks the server to open cargo (gs-trailers:server:openInventory). The server checks that the trailer exists, whitelist / type, distance, and GetTrailerInventorySettings, then calls:
function OpenTrailerInventory(source, data)
-- data.id stash id (gs_trailer_<plate>)
-- data.label locale('trailer_inventory') or per-trailer label
-- data.slots number
-- data.weight grams
-- data.kind resolved system name (ox_inventory, qb-inventory, ...)
-- data.resource export resource folder
endThe bundled file already opens:
- ox_inventory (
RegisterStash+forceOpenInventory) - qb-inventory / ps-inventory
- qs-inventory
- origen_inventory
- codem-inventory
- tgiann-inventory
- core_inventory
- jpr-inventory
- mf-inventory
If your inventory is not in the list, add an elseif that registers a stash (if needed) and opens it for source. Keep the other branches. pcall is used so a missing export does not error the resource.
core_inventory stash sizes often come from its own inventory types. Add a matching type there if slots / weight do not apply.
This function is not called when Config.Inventory.Enable is false, when a trailer has inventory = false, or when no supported inventory is started.
