💳Licenses

Adding new licenses used to require some code modification. Now using HapticLib you will be able to add new licenses that use metadata. Since you are using the LC-Dev variant of HapticLib you will have extra files that the github build wont have.

In HapticLib/Server/LC-Cityhall.lua you can add what meta info you need for your new license types.

function functions.AddCityHallLicense(source, id_to_give)
    local Player = QBCore.Functions.GetPlayer(source)
    local info = {}
    if id_to_give == "id_card" then
        info.citizenid = Player.PlayerData.citizenid
        info.firstname = Player.PlayerData.charinfo.firstname
        info.lastname = Player.PlayerData.charinfo.lastname
        info.birthdate = Player.PlayerData.charinfo.birthdate
        info.gender = Player.PlayerData.charinfo.gender
        info.nationality = Player.PlayerData.charinfo.nationality
    elseif id_to_give == "driver_license" then
        info.firstname = Player.PlayerData.charinfo.firstname
        info.lastname = Player.PlayerData.charinfo.lastname
        info.birthdate = Player.PlayerData.charinfo.birthdate
        info.type = "Class C Driver License"
    elseif id_to_give == "weaponlicense" then
        info.firstname = Player.PlayerData.charinfo.firstname
        info.lastname = Player.PlayerData.charinfo.lastname
        info.birthdate = Player.PlayerData.charinfo.birthdate
    end
    exports['qb-inventory']:AddItem(source, id_to_give, 1, false, info, "LC-CityHall")
    TriggerClientEvent('qb-inventory:client:ItemBox', source, QBCore.Shared.Items[id_to_give], 'add', 1)
    return true
end

In LC-CityHall/config.lua you can add new licenses here.

Config.LicensesOptions = {
    ["id_card"] = {position = 1, label = "Citizen Card", description = "Get your ID", enabled = true, price = 100},
    ["driver_license"] = {position = 2, label = "Drivers License", description = "Get your drivers license", enabled = true, price = 0},
	["weaponslicense"] = {position = 3, label = "Weapons License", description = "Get your weapons license", enabled = false, price = 0},  -- This is part of qb-id dont enable if you dont use it https://github.com/alp1x/qb-idcard
    ["huntinglicense"] = {position = 4, label = "Hunting License", description = "Get your hunting license", enabled = false, price = 0},  -- This is a custom item
    
}

Last updated