This commit is contained in:
Nordi98 2025-07-30 01:33:52 +02:00
parent 98a52d34f5
commit 44c5ed941b
3 changed files with 126 additions and 72 deletions

View file

@ -1,19 +1,20 @@
local QBCore = exports['qb-core']:GetCoreObject()
-- Open backpack inventory
RegisterNetEvent('backpack:server:openInventory', function(backpackStashId, backpackId, textureId)
RegisterNetEvent('backpack:server:openInventory', function(backpackStashId, backpackId, textureId, gender)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
-- Open the inventory
local backpackConfig = Config.Backpacks[backpackId]
if not backpackConfig then
print("Error: Backpack config not found for ID " .. backpackId)
if not Config.Backpacks[gender] or not Config.Backpacks[gender][backpackId] then
print("Error: Backpack config not found for Gender=" .. gender .. ", ID=" .. backpackId)
return
end
local backpackConfig = Config.Backpacks[gender][backpackId]
exports["tgiann-inventory"]:OpenInventory(src, "stash", backpackStashId, {
maxweight = backpackConfig.maxweight,
slots = backpackConfig.slots,
@ -30,6 +31,7 @@ RegisterNetEvent('backpack:server:openInventory', function(backpackStashId, back
Config.Logs.openTitle,
Config.Logs.openColor,
'**Player:** ' .. Player.PlayerData.name ..
'\n**Gender:** ' .. (gender == 0 and "Male" or "Female") ..
'\n**Backpack Type:** ' .. backpackConfig.label ..
'\n**Backpack ID:** ' .. backpackId ..
'\n**Texture ID:** ' .. textureId ..
@ -48,16 +50,17 @@ QBCore.Commands.Add('listclothing', 'List all clothing components (Debug)', {},
end)
-- Receive backpack info from client and show notification
RegisterNetEvent('backpack:server:showBackpackInfo', function(backpackId, textureId)
RegisterNetEvent('backpack:server:showBackpackInfo', function(backpackId, textureId, gender)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if backpackId and Config.Backpacks[backpackId] then
local backpackConfig = Config.Backpacks[backpackId]
if backpackId and Config.Backpacks[gender] and Config.Backpacks[gender][backpackId] then
local backpackConfig = Config.Backpacks[gender][backpackId]
TriggerClientEvent('ox_lib:notify', src, {
title = 'Backpack Info',
description = 'Type: ' .. backpackConfig.label ..
'\nGender: ' .. (gender == 0 and "Male" or "Female") ..
'\nDrawable ID: ' .. backpackId ..
'\nTexture ID: ' .. textureId ..
'\nCapacity: ' .. (backpackConfig.maxweight / 1000) .. 'kg' ..