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)
|
||||
|
||||
Reference in New Issue
Block a user