Qbox Integration

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

File Modifications

Add Items

Add the following items to your inventory:

  • drive_truck
  • drive_bus
  • drive_boat
  • drive_bike
  • drive_plane

qbx_cityhall/config/shared.lua

Update or insert the following license configurations under cityhalls -> licenses:

qbx_cityhall/config/shared.lua
licenses = {
  ['id'] = {
      item = 'id_card',
      label = 'ID',
      cost = 50,
  },
  ['drive_license'] = {
      item = 'driver_license',
      label = 'Driver License',
      cost = 50,
  },
  ['drive_truck'] = {
      item = 'drive_truck',
      label = 'Trucker License',
      cost = 500,
  },
  ['drive_bus'] = {
      item = 'drive_bus',
      label = 'Bus Driver License',
      cost = 250,
  },
  ['drive_boat'] = {
      item = 'drive_boat',
      label = 'Boat License',
      cost = 350,
  },
  ['drive_bike'] = {
      item = 'drive_bike',
      label = 'Class 6A Bike License',
      cost = 50,
  },
  ['drive_plane'] = {
      item = 'drive_plane',
      label = 'Pilot License',
      cost = 3000,
  },
  ['weapon'] = {
      item = 'weaponlicense',
      label = 'Weapon License',
      cost = 50,
  },
},

qbx_cityhall/server/main.lua

Replace this code.

qbx_cityhall/server/main.lua
lib.callback.register('qbx_cityhall:server:requestId', function(source, item, hall)
    local player = exports.qbx_core:GetPlayer(source)
    if not player then return end
    local itemType = sharedConfig.cityhalls[hall].licenses[item]

    if itemType.item ~= 'id_card' and itemType.item ~= 'driver_license' and itemType.item ~= 'weaponlicense' and string.sub(itemType.item, 1, 6) ~= "drive_" then
        return exports.qbx_core:Notify(source, locale('error.invalid_type'), 'error')
    end

    if not player.Functions.RemoveMoney('cash', itemType.cost) then
        return exports.qbx_core:Notify(source, locale('error.not_enough_money'), 'error')
    end

    exports.qbx_idcard:CreateMetaLicense(source, itemType.item)
    exports.qbx_core:Notify(source, locale('success.item_recieved') .. itemType.label, 'success')
end)