fix(qb-core): add global CreateUsableItem alias for qs-inventory compatibility

qs-inventory apelează CreateUsableItem ca funcție globală, dar qb-core definea doar QBCore.Functions.CreateUseableItem (cu 'e'). Adăugat alias global + fix 16 stringuri sparte în items.lua care blocau parsarea.
This commit is contained in:
2026-04-02 00:08:19 +03:00
parent 096ccb6399
commit 978c9bc759
827 changed files with 3570 additions and 1015 deletions

View File

@@ -0,0 +1,90 @@
--[[
Hi dear customer or developer, here you can fully configure your server's
framework or you could even duplicate this file to create your own framework.
If you do not have much experience, we recommend you download the base version
of the framework that you use in its latest version and it will work perfectly.
]]
if Config.Framework ~= 'esx' then
return
end
ESX = exports['es_extended']:getSharedObject()
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
Wait(10000)
StartThread()
end)
AddEventHandler('onClientResourceStart', function(resourceName)
if (GetCurrentResourceName() == resourceName) then
ESX = exports['es_extended']:getSharedObject()
Wait(10000)
StartThread()
end
end)
function getSex()
local promise = promise.new()
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
promise:resolve(skin.sex)
end)
return Citizen.Await(promise)
end
function OpenStash(metadata)
local other = {}
other.maxweight = metadata.weight
other.slots = metadata.slots
TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'Backpack_' .. metadata.ID, other)
TriggerEvent('inventory:client:SetCurrentStash', 'Backpack_' .. metadata.ID)
repeat Wait(1000) until IsNuiFocused() == false
TriggerEvent('backpacks:client:close', metadata.ID)
end
function SendTextMessage(msg, type)
if type == 'inform' then
lib.notify({
title = 'Inventory',
description = msg,
type = 'inform'
})
end
if type == 'error' then
lib.notify({
title = 'Inventory',
description = msg,
type = 'error'
})
end
if type == 'success' then
lib.notify({
title = 'Inventory',
description = msg,
type = 'success'
})
end
end
function Progressbar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
if lib.progressCircle({
duration = duration,
label = label,
position = 'bottom',
useWhileDead = useWhileDead,
canCancel = canCancel,
disable = disableControls,
anim = {
dict = animation.animDict,
clip = animation.anim,
flag = animation?.flags
},
prop = prop
}) then
onFinish()
else
onCancel()
end
end

View File

@@ -0,0 +1,85 @@
--[[
Hi dear customer or developer, here you can fully configure your server's
framework or you could even duplicate this file to create your own framework.
If you do not have much experience, we recommend you download the base version
of the framework that you use in its latest version and it will work perfectly.
]]
if Config.Framework ~= 'qb' then
return
end
QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
AddEventHandler('QBCore:Client:OnPlayerLoaded', function(xPlayer)
Wait(10000)
StartThread()
end)
AddEventHandler('onClientResourceStart', function(resourceName)
if (GetCurrentResourceName() == resourceName) then
QBCore = exports['qb-core']:GetCoreObject()
Wait(10000)
StartThread()
end
end)
function getSex()
return QBCore.Functions.GetPlayerData()?.charinfo?.gender
end
function OpenStash(metadata)
local other = {}
other.maxweight = metadata.weight
other.slots = metadata.slots
TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'Backpack_' .. metadata.ID, other)
TriggerEvent('inventory:client:SetCurrentStash', 'Backpack_' .. metadata.ID)
repeat Wait(1000) until IsNuiFocused() == false
TriggerEvent('backpacks:client:close', metadata.ID)
end
function SendTextMessage(msg, type)
if type == 'inform' then
lib.notify({
title = 'Inventory',
description = msg,
type = 'inform'
})
end
if type == 'error' then
lib.notify({
title = 'Inventory',
description = msg,
type = 'error'
})
end
if type == 'success' then
lib.notify({
title = 'Inventory',
description = msg,
type = 'success'
})
end
end
function Progressbar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
if lib.progressCircle({
duration = duration,
label = label,
position = 'bottom',
useWhileDead = useWhileDead,
canCancel = canCancel,
disable = disableControls,
anim = {
dict = animation.animDict,
clip = animation.anim,
flag = animation?.flags
},
prop = prop
}) then
onFinish()
else
onCancel()
end
end

View File

@@ -0,0 +1,47 @@
if Config.Menu ~= 'esx_menu_default' then
return
end
function CreateBackpack(ID)
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'create_password',
{
title = Lang('CREATE_PASSWORD'),
}, function(data, menu)
local length = string.len(data.value)
if length <= 0 then
SendTextMessage(Lang('BAD_PASSWORD'), 'error')
elseif length < Config.PasswordLength.min then
SendTextMessage(Lang('MORE_PASSWORD'), 'error')
elseif length > Config.PasswordLength.max then
SendTextMessage(Lang('LESS_PASSWORD'), 'error')
else
SendTextMessage(Lang('ADDED_PASSWORD'), 'success')
TriggerServerEvent('backpacks:server:add_password', { ID = ID, password = data.value })
menu.close()
end
end, function(data, menu)
menu.close()
end)
end
function CheckMeta(backpack_metadata)
if backpack_metadata.locked then
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'enter_password',
{
title = Lang('INTRODUCE_PASSWORD'),
}, function(data, menu)
if backpack_metadata.password == data.value then
menu.close()
backpack_metadata.trypassword = data.value
OpenBackpack(backpack_metadata)
else
SendTextMessage(Lang('BAD_PASSWORD'), 'error')
menu.close()
end
end, function(data, menu)
menu.close()
end)
else
OpenBackpack(backpack_metadata)
end
end

View File

@@ -0,0 +1,48 @@
if Config.Menu ~= 'ox_lib' then
return
end
function CreateBackpack(ID)
if not lib then
print('You need to uncomment the ox_lib export on line 10 of qs-backpacks/fxmanifest.lua')
return
end
local keyboard1 = lib.inputDialog(Lang('CREATE_PASSWORD') .. ' Min ' .. Config.PasswordLength.min .. ' Max ' .. Config.PasswordLength.max, { Lang('INTRODUCE_PASSWORD_2') })
if not keyboard1 then return end
local pass = tostring(keyboard1[1])
local length = string.len(pass)
if length <= 0 then
SendTextMessage(Lang('BAD_PASSWORD'), 'error')
return
end
if length < Config.PasswordLength.min then
SendTextMessage(Lang('MORE_PASSWORD'), 'error')
return
end
if length > Config.PasswordLength.max then
SendTextMessage(Lang('LESS_PASSWORD'), 'error')
return
end
SendTextMessage(Lang('ADDED_PASSWORD'), 'success')
TriggerServerEvent('backpacks:server:add_password', { ID = ID, password = pass })
end
function CheckMeta(backpack_metadata)
if backpack_metadata.locked then
if not lib then
print('You need to uncomment the ox_lib export on line 10 of qs-backpacks/fxmanifest.lua')
return
end
local data = lib.inputDialog(Lang('INTRODUCE_PASSWORD'), { Lang('INTRODUCE_PASSWORD_2') })
if not data then
SendTextMessage(Lang('BAD_PASSWORD'), 'error')
return
end
backpack_metadata.trypassword = data[1]
OpenBackpack(backpack_metadata)
else
OpenBackpack(backpack_metadata)
end
end

View File

@@ -0,0 +1,64 @@
if Config.Menu ~= 'qb-menu' then
return
end
function CreateBackpack(ID)
local inputData = exports['qb-input']:ShowInput({
header = Lang('CREATE_PASSWORD') .. ' Min ' .. Config.PasswordLength.min .. ' Max ' .. Config.PasswordLength.max,
inputs = {
{
type = 'password',
isRequired = true,
name = 'pass', -- name of the input should be unique otherwise it might override
type = 'password', -- type of the input
text = Lang('INTRODUCE_PASSWORD_2'),
},
}
})
if inputData then
if not inputData.pass then return end
local length = string.len(inputData.pass)
if length <= 0 then
SendTextMessage(Lang('BAD_PASSWORD'), 'error')
return
end
if length < Config.PasswordLength.min then
SendTextMessage(Lang('MORE_PASSWORD'), 'error')
return
end
if length > Config.PasswordLength.max then
SendTextMessage(Lang('LESS_PASSWORD'), 'error')
return
end
SendTextMessage(Lang('ADDED_PASSWORD'), 'success')
TriggerServerEvent('backpacks:server:add_password', { ID = ID, password = inputData.pass })
end
end
function CheckMeta(backpack_metadata)
if backpack_metadata.locked then
local inputData = exports['qb-input']:ShowInput({
header = Lang('INTRODUCE_PASSWORD'),
inputs = {
{
type = 'password',
isRequired = true,
name = 'pass',
text = Lang('INTRODUCE_PASSWORD')
},
}
})
if inputData then
if not inputData.pass then
SendTextMessage(Lang('BAD_PASSWORD'), 'error')
return
end
backpack_metadata.trypassword = inputData.pass
OpenBackpack(backpack_metadata)
end
else
OpenBackpack(backpack_metadata)
end
end

View File

@@ -0,0 +1,32 @@
if Config.SkinScript ~= 'esx_skin' then
return
end
function putClothes(backpack)
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
local clothes = {
male = { ['bags_1'] = backpack.cloth['male'].bag['item'], ['bags_2'] = backpack.cloth['male'].bag['texture'] },
female = { ['bags_1'] = backpack.cloth['female'].bag['item'], ['bags_2'] = backpack.cloth['male'].bag['texture'] },
}
if skin.sex == 0 then
TriggerEvent('skinchanger:loadClothes', skin, clothes.male)
elseif skin.sex == 1 then
TriggerEvent('skinchanger:loadClothes', skin, clothes.female)
end
end)
end
function RemoveClothes()
local cloth = {
male = { ['bags_1'] = 0 },
female = { ['bags_1'] = 0 },
}
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
TriggerEvent('skinchanger:loadClothes', skin, cloth.male)
elseif skin.sex == 1 then
TriggerEvent('skinchanger:loadClothes', skin, cloth.female)
end
end)
end

View File

@@ -0,0 +1,19 @@
if Config.SkinScript ~= 'illenium-appearance' then
return
end
function putClothes(backpack)
if getSex() == 0 then
TriggerEvent('qb-clothing:client:loadOutfit', { outfitData = backpack.cloth['male'] })
else
TriggerEvent('qb-clothing:client:loadOutfit', { outfitData = backpack.cloth['female'] })
end
end
function RemoveClothes()
TriggerEvent('qb-clothing:client:loadOutfit', {
outfitData = {
['bag'] = { item = -1, texture = 0 }
}
})
end

View File

@@ -0,0 +1,19 @@
if Config.SkinScript ~= 'qb-clothing' then
return
end
function putClothes(backpack)
if getSex() == 0 then
TriggerEvent('qb-clothing:client:loadOutfit', { outfitData = backpack.cloth['male'] })
else
TriggerEvent('qb-clothing:client:loadOutfit', { outfitData = backpack.cloth['female'] })
end
end
function RemoveClothes()
TriggerEvent('qb-clothing:client:loadOutfit', {
outfitData = {
['bag'] = { item = -1, texture = 0 }
}
})
end