fix(qs-inventory, 0r_idcard): id_card metadata + gender mapping + pcall clothing
- Fix Config.Genders: adăugat [0]=Male (QBCore folosește 0/1, nu 1/2) - Fix 0r_idcard: addItem trimite acum metadata (firstname, lastname etc) - pcall pe handleDeleteItem în RemoveItem.lua (qs-smartphone-pro compat) - Framework forțat QB, debug dezactivat
This commit is contained in:
@@ -7,6 +7,20 @@ RegisterNetEvent("0r_idcard:server:saveHeadshot", function(shot)
|
||||
local player = getExtendedPlayer(src)
|
||||
local license = getPlayerLicense(player)
|
||||
|
||||
-- Build metadata for qs-inventory id_card display
|
||||
local cardInfo = {}
|
||||
if Config.Framework == "qb" then
|
||||
local charinfo = player.PlayerData.charinfo
|
||||
cardInfo = {
|
||||
citizenid = player.PlayerData.citizenid,
|
||||
firstname = charinfo.firstname,
|
||||
lastname = charinfo.lastname,
|
||||
birthdate = charinfo.birthdate,
|
||||
gender = charinfo.gender == 0 and 'Male' or 'Female',
|
||||
nationality = charinfo.nationality or 'Unknown'
|
||||
}
|
||||
end
|
||||
|
||||
if license then
|
||||
local result = mysqlQuery("SELECT id_card_given FROM 0r_idcard WHERE license = @license", {["@license"] = license})
|
||||
|
||||
@@ -15,12 +29,12 @@ RegisterNetEvent("0r_idcard:server:saveHeadshot", function(shot)
|
||||
mysqlQuery("UPDATE 0r_idcard SET photo = @photo WHERE license = @license", {["@photo"] = shot, ["@license"] = license})
|
||||
-- Give id_card only once (first mugshot)
|
||||
if result[1].id_card_given == 0 then
|
||||
addItem(src, Config.IdCard, 1)
|
||||
addItem(src, Config.IdCard, 1, cardInfo)
|
||||
mysqlQuery("UPDATE 0r_idcard SET id_card_given = 1 WHERE license = @license", {["@license"] = license})
|
||||
end
|
||||
else
|
||||
mysqlQuery("INSERT INTO 0r_idcard (license, photo, id_card_given) VALUES (@license, @photo, 1)", {["@license"] = license, ["@photo"] = shot})
|
||||
addItem(src, Config.IdCard, 1)
|
||||
addItem(src, Config.IdCard, 1, cardInfo)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -99,7 +99,7 @@ function removeMoney(src, amount)
|
||||
return false
|
||||
end
|
||||
|
||||
function addItem(src, item, amoumt)
|
||||
function addItem(src, item, amoumt, info)
|
||||
local player = getExtendedPlayer(src)
|
||||
|
||||
while player == nil do
|
||||
@@ -108,7 +108,7 @@ function addItem(src, item, amoumt)
|
||||
end
|
||||
|
||||
if Config.Framework == "qb" then
|
||||
player.Functions.AddItem(item, amoumt)
|
||||
player.Functions.AddItem(item, amoumt, nil, info)
|
||||
elseif Config.Framework == "esx" then
|
||||
player.addInventoryItem(item, amoumt)
|
||||
end
|
||||
|
||||
@@ -58,7 +58,7 @@ local frameworks = { -- [CORE] Resource name → internal alias
|
||||
['qb-core'] = 'qb',
|
||||
['qbx_core'] = 'qb'
|
||||
}
|
||||
Config.Framework = DependencyCheck(frameworks) or 'none' -- [AUTO]
|
||||
Config.Framework = 'qb' -- [EDIT] Forțat QB (auto-detect dezactivat)
|
||||
|
||||
local qbxHas = GetResourceState('qbx_core') == 'started' -- [AUTO]
|
||||
Config.QBX = qbxHas -- [AUTO]
|
||||
@@ -332,7 +332,8 @@ Config.MaxDropViewDistance = 9.5 -- [EDIT] Max view dista
|
||||
Config.Genders = {
|
||||
['m'] = 'Male',
|
||||
['f'] = 'Female',
|
||||
[1] = 'Male',
|
||||
[0] = 'Male',
|
||||
[1] = 'Female',
|
||||
[2] = 'Female'
|
||||
}
|
||||
|
||||
@@ -442,7 +443,7 @@ Config.KeyBinds = { -- [EDIT]
|
||||
-- Debug & Development Tools [EDIT]
|
||||
-- [INFO] Enables development logs and debugging prints. Use only during testing.
|
||||
--──────────────────────────────────────────────────────────────────────────────
|
||||
Config.Debug = true -- [EDIT] Detailed console prints
|
||||
Config.Debug = false -- [EDIT] Detailed console prints
|
||||
Config.ZoneDebug = false -- [EDIT] Display additional zone debug info
|
||||
Config.InventoryPrefix = 'inventory' -- [ADV] Internal prefix; changing requires code adjustments
|
||||
Config.SaveInventoryInterval = 12500 -- [EDIT] Autosave interval (ms)
|
||||
|
||||
Reference in New Issue
Block a user