forked from Simnation/Main
Update sv_utils.lua
This commit is contained in:
parent
dced44a739
commit
4bfed9952c
1 changed files with 20 additions and 18 deletions
|
@ -84,31 +84,33 @@ end
|
|||
RegisterNetEvent("brutal_housing:qb-inventory:server:OpenInventory", function(job, data)
|
||||
local src = source
|
||||
|
||||
-- For stash inventories
|
||||
if job == "stash" then
|
||||
-- Make sure invId is a string
|
||||
local stashId = tostring(data.id or "housing_" .. src)
|
||||
-- Check if job contains both type and ID (like "stash_H104_17548482891")
|
||||
if string.find(job, "stash_") then
|
||||
-- Extract the actual stash ID by removing "stash_" prefix
|
||||
local stashId = string.gsub(job, "stash_", "")
|
||||
|
||||
-- Open the inventory with proper parameters
|
||||
exports["tgiann-inventory"]:OpenInventory(src, "stash", stashId, {
|
||||
maxWeight = data.weight or 10000,
|
||||
slots = data.slots or 50,
|
||||
label = data.label or "Housing Stash"
|
||||
label = data.label or "Housing Stash " .. stashId
|
||||
})
|
||||
-- For trunk inventories
|
||||
elseif job == "trunk" then
|
||||
-- Make sure plate is a string
|
||||
local plate = tostring(data)
|
||||
|
||||
-- Handle trunk inventories
|
||||
elseif string.find(job, "trunk_") then
|
||||
local plate = string.gsub(job, "trunk_", "")
|
||||
exports["tgiann-inventory"]:OpenInventory(src, "trunk", plate)
|
||||
-- For glovebox inventories
|
||||
elseif job == "glovebox" then
|
||||
-- Make sure plate is a string
|
||||
local plate = tostring(data)
|
||||
|
||||
-- Handle glovebox inventories
|
||||
elseif string.find(job, "glovebox_") then
|
||||
local plate = string.gsub(job, "glovebox_", "")
|
||||
exports["tgiann-inventory"]:OpenInventory(src, "glovebox", plate)
|
||||
-- For other inventory types
|
||||
-- Handle regular inventory types
|
||||
elseif job == "stash" or job == "trunk" or job == "glovebox" then
|
||||
-- For cases where job and data are properly separated
|
||||
local invId = tostring(data)
|
||||
exports["tgiann-inventory"]:OpenInventory(src, job, invId)
|
||||
else
|
||||
-- Log error for unsupported inventory types
|
||||
print("Unsupported inventory type: " .. job)
|
||||
-- Log error for truly unsupported inventory types
|
||||
print("Truly unsupported inventory type: " .. job)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue