If anyone remembers in the old version there was a qbcore snippet to check for gun licenses i really missed this feature so figured out how to do it in the new version and thought id share it with everyone
paste this into the server.lua
function hasWeaponLicense(source)
local xPlayer = QBCore.Functions.GetPlayer(source)
if xPlayer then
return xPlayer.PlayerData.metadata['licences'].weapon
end
end
around line 400 in the server lua replace the canbuyproducts function with this one
function CanBuyProducts(source, id, cart)
local store = FindStoreByID(id)
local cart_weight = 0
local player_weight = getWeight(source)
for _, product in pairs(store.information.products) do
for _, item in pairs(cart) do
if item.name == product.name then
if string.sub(item.name, 1, 7) == "weapon_" and not hasWeaponLicense(source) then
ShowMessage(source, "You do not have a weapon license to purchase this item.")
return false
end
if config.amount_no_owner == 0 or store.information.owner ~= "" then
if product.amount < item.selected_amount then
ShowMessage(source, translate.TR_STORE_NOT_AMOUNT)
return false
end
end
if config.use_weight_system then
cart_weight = cart_weight + (product.weight * item.selected_amount)
end
end
end
end
if config.use_weight_system and (player_weight + cart_weight > config.max_weight) then
ShowMessage(source, translate.TR_INVENTORY_FULL)
return false
end
return true
end