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)
|
RegisterNetEvent("brutal_housing:qb-inventory:server:OpenInventory", function(job, data)
|
||||||
local src = source
|
local src = source
|
||||||
|
|
||||||
-- For stash inventories
|
-- Check if job contains both type and ID (like "stash_H104_17548482891")
|
||||||
if job == "stash" then
|
if string.find(job, "stash_") then
|
||||||
-- Make sure invId is a string
|
-- Extract the actual stash ID by removing "stash_" prefix
|
||||||
local stashId = tostring(data.id or "housing_" .. src)
|
local stashId = string.gsub(job, "stash_", "")
|
||||||
|
|
||||||
|
-- Open the inventory with proper parameters
|
||||||
exports["tgiann-inventory"]:OpenInventory(src, "stash", stashId, {
|
exports["tgiann-inventory"]:OpenInventory(src, "stash", stashId, {
|
||||||
maxWeight = data.weight or 10000,
|
maxWeight = data.weight or 10000,
|
||||||
slots = data.slots or 50,
|
slots = data.slots or 50,
|
||||||
label = data.label or "Housing Stash"
|
label = data.label or "Housing Stash " .. stashId
|
||||||
})
|
})
|
||||||
-- For trunk inventories
|
-- Handle trunk inventories
|
||||||
elseif job == "trunk" then
|
elseif string.find(job, "trunk_") then
|
||||||
-- Make sure plate is a string
|
local plate = string.gsub(job, "trunk_", "")
|
||||||
local plate = tostring(data)
|
|
||||||
|
|
||||||
exports["tgiann-inventory"]:OpenInventory(src, "trunk", plate)
|
exports["tgiann-inventory"]:OpenInventory(src, "trunk", plate)
|
||||||
-- For glovebox inventories
|
-- Handle glovebox inventories
|
||||||
elseif job == "glovebox" then
|
elseif string.find(job, "glovebox_") then
|
||||||
-- Make sure plate is a string
|
local plate = string.gsub(job, "glovebox_", "")
|
||||||
local plate = tostring(data)
|
|
||||||
|
|
||||||
exports["tgiann-inventory"]:OpenInventory(src, "glovebox", plate)
|
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
|
else
|
||||||
-- Log error for unsupported inventory types
|
-- Log error for truly unsupported inventory types
|
||||||
print("Unsupported inventory type: " .. job)
|
print("Truly unsupported inventory type: " .. job)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue