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
@@ -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
@@ -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
@@ -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