QBCore Integration

This guide documents the installation for our Drivingschool with full QB City Hall integration.

File Modifications

qb-core/shared/items.lua

Add the following items under qb-core > shared > items:

qb-core/shared/items.lua
drive_truck = { name = 'drive_truck', label = 'Trucker License', weight = 0, type = 'item', image = 'driver_license.png', unique = true, useable = true, shouldClose = true, description = '' },
drive_bus   = { name = 'drive_bus',   label = 'Bus License',     weight = 0, type = 'item', image = 'driver_license.png', unique = true, useable = true, shouldClose = true, description = '' },
drive_boat  = { name = 'drive_boat',  label = 'Boat License',    weight = 0, type = 'item', image = 'driver_license.png', unique = true, useable = true, shouldClose = true, description = '' },
drive_bike  = { name = 'drive_bike',  label = 'Bike License',    weight = 0, type = 'item', image = 'driver_license.png', unique = true, useable = true, shouldClose = true, description = '' },
drive_plane = { name = 'drive_plane', label = 'Plane License',   weight = 0, type = 'item', image = 'driver_license.png', unique = true, useable = true, shouldClose = true, description = '' },

qb-cityhall/config.lua

Update or insert the following license configurations under licenses:

qb-cityhall/config.lua
licenses = {
    ['id_card'] = {
        label = 'ID Card',
        cost = 10,
    },
    ['driver_license'] = {
        label = 'Driver License',
        cost = 50,
        metadata = 'driver'
    },
    ['drive_truck'] = {
        label = 'Trucker License',
        cost = 500,
        metadata = 'drive_truck'
    },
    ['drive_bus'] = {
        label = 'Bus Driver License',
        cost = 250,
        metadata = 'drive_bus'
    },
    ['drive_boat'] = {
        label = 'Boat License',
        cost = 350,
        metadata = 'drive_boat'
    },
    ['drive_bike'] = {
        label = 'Class 6A Bike License',
        cost = 50,
        metadata = 'drive_bike'
    },
    ['drive_plane'] = {
        label = 'Pilot License',
        cost = 3000,
        metadata = 'drive_plane'
    },
    ['weaponlicense'] = {
        label = 'Weapon License',
        cost = 50,
        metadata = 'weapon'
    },
}

qb-cityhall/server/main.lua

Inside the license creation logic, add handling for each license type:

qb-cityhall/server/main.lua
elseif item == 'drive_truck' then
    info.firstname = Player.PlayerData.charinfo.firstname
    info.lastname = Player.PlayerData.charinfo.lastname
    info.birthdate = Player.PlayerData.charinfo.birthdate
    info.type = 'Class 1 Trucker License'
elseif item == 'drive_bus' then
    info.firstname = Player.PlayerData.charinfo.firstname
    info.lastname = Player.PlayerData.charinfo.lastname
    info.birthdate = Player.PlayerData.charinfo.birthdate
    info.type = 'Bus Driver License'
elseif item == 'drive_boat' then
    info.firstname = Player.PlayerData.charinfo.firstname
    info.lastname = Player.PlayerData.charinfo.lastname
    info.birthdate = Player.PlayerData.charinfo.birthdate
    info.type = 'Boat License'
elseif item == 'drive_bike' then
    info.firstname = Player.PlayerData.charinfo.firstname
    info.lastname = Player.PlayerData.charinfo.lastname
    info.birthdate = Player.PlayerData.charinfo.birthdate
    info.type = 'Class 6A Bike License'
elseif item == 'drive_plane' then
    info.firstname = Player.PlayerData.charinfo.firstname
    info.lastname = Player.PlayerData.charinfo.lastname
    info.birthdate = Player.PlayerData.charinfo.birthdate
    info.type = 'Pilot License'