qb-shops
1.2.1​
Replace
qb-shops/client/main.lua
if curProduct.requiredLicense and not hasLicense(curProduct.requiredLicense, PlayerData.metadata["licences"]) then
addProduct = false
for _, license in ipairs(curProduct.requiredLicense) do
if not PlayerData.metadata["licences"][license] and not notifiedLicenses[license] then
QBCore.Functions.Notify(string.format(Lang:t("error.missing_license"), license), "error")
notifiedLicenses[license] = true
end
end
end
with
qb-shops/client/main.lua
if curProduct.requiredLicense then
local itemLicense = promise.new()
QBCore.Functions.TriggerCallback('esx_license:checkLicense', function(have)
if have and QBCore.Functions.HasItem(curProduct.requiredLicense) then
itemLicense:resolve(true)
else
itemLicense:resolve(false)
end
end, GetPlayerServerId(PlayerId()), curProduct.requiredLicense)
Citizen.Await(itemLicense)
if not itemLicense then
addProduct = false
for _, license in ipairs(curProduct.requiredLicense) do
if not itemLicense and not notifiedLicenses[license] then
QBCore.Functions.Notify(string.format(Lang:t("error.missing_license"), license), "error")
notifiedLicenses[license] = true
end
end
end
end
Old Version​
replace
qb-shops/client/main.lua
if PlayerData.metadata["licences"] and PlayerData.metadata["licences"].weapon and QBCore.Functions.HasItem("weaponlicense") then
ShopItems.items = SetupItems()
QBCore.Functions.Notify(Lang:t("success.dealer_verify"), "success")
Wait(500)
else
ShopItems.items = SetupItems(true)
QBCore.Functions.Notify(Lang:t("error.dealer_decline"), "error")
Wait(500)
QBCore.Functions.Notify(Lang:t("error.talk_cop"), "error")
Wait(1000)
end
with
qb-shops/client/main.lua
local items = promise.new()
QBCore.Functions.TriggerCallback('esx_license:checkLicense', function(have)
if have and QBCore.Functions.HasItem("weapon") then
items:resolve(SetupItems())
QBCore.Functions.Notify(Lang:t("success.dealer_verify"), "success")
Wait(500)
else
items:resolve(SetupItems(true))
QBCore.Functions.Notify(Lang:t("error.dealer_decline"), "error")
Wait(500)
QBCore.Functions.Notify(Lang:t("error.talk_cop"), "error")
Wait(1000)
end
end, GetPlayerServerId(PlayerId()), 'weapon')
ShopItems.items = Citizen.Await(items)