Skip to main content

Bit License Schools

bit-drivingschool​

config.lua
function applyLicense(xPlayer, license)
if Config.Framework == "esx" then
if license == 'A' then
TriggerClientEvent('LicenseManager:addLicense', xPlayer.source, 'driver_bike', 'Fahrschule')
elseif license == 'B' then
TriggerClientEvent('LicenseManager:addLicense', xPlayer.source, 'driver_car', 'Fahrschule')
elseif license == 'C' then
TriggerClientEvent('LicenseManager:addLicense', xPlayer.source, 'driver_truck', 'Fahrschule')
end
elseif Config.Framework == "qb" then
if license == 'A' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameMoto] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerClientEvent('LicenseManager:addLicense', xPlayer.PlayerData.source, 'driver_bike', 'Fahrschule')
elseif license == 'B' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameCar] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerClientEvent('LicenseManager:addLicense', xPlayer.PlayerData.source, 'driver_car', 'Fahrschule')
elseif license == 'C' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameTruck] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerClientEvent('LicenseManager:addLicense', xPlayer.PlayerData.source, 'driver_truck', 'Fahrschule')
end
end
end

function deleteLicense(xPlayer)
if Config.Framework == "esx" then
TriggerEvent('LicenseManager:revokeLicense', xPlayer.identifier, Config.licenseNameCar, xPlayer.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.identifier, Config.licenseNameMoto, xPlayer.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.identifier, Config.licenseNameTruck, xPlayer.source)
SqlFunc(Config.Mysql,'execute','DELETE FROM bit_driverschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
notifications(Noti.check, Lang.deletedLicense, Noti.time)
elseif Config.Framework == "qb" then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameMoto] = false
licenseTable[Config.licenseNameCar] = false
licenseTable[Config.licenseNameTruck] = false
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.PlayerData.citizenid, Config.licenseNameCar, xPlayer.PlayerData.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.PlayerData.citizenid, Config.licenseNameMoto, xPlayer.PlayerData.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.PlayerData.citizenid, Config.licenseNameTruck, xPlayer.PlayerData.source)
SqlFunc(Config.Mysql,'execute','DELETE FROM bit_driverschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
notifications(Noti.check, Lang.deletedLicense, Noti.time)
end
end

bit-flightschool​

config.lua
function applyLicense(xPlayer, license)
if Config.Framework == "esx" then
if license == 'HPL' then
TriggerClientEvent('LicenseManager:addLicense', xPlayer.source, 'flight_helicopter', 'Fahrschule')
elseif license == 'PPL' then
TriggerClientEvent('LicenseManager:addLicense', xPlayer.source, 'flight_plane', 'Fahrschule')
end
elseif Config.Framework == "qb" then
if license == 'HPL' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameHelicopter] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerClientEvent('LicenseManager:addLicense', xPlayer.PlayerData.source, 'flight_helicopter', 'Fahrschule')
elseif license == 'PPL' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNamePlane] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerClientEvent('LicenseManager:addLicense', xPlayer.PlayerData.source, 'flight_plane', 'Fahrschule')

end
end
end

function deleteLicense(xPlayer)
if Config.Framework == "esx" then
TriggerEvent('LicenseManager:revokeLicense', xPlayer.identifier, Config.licenseNameHelicopter, xPlayer.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.identifier, Config.licenseNamePlane, xPlayer.source)
SqlFunc(Config.Mysql,'execute','DELETE FROM bit_flightschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
notifications(Noti.check, Lang.deletedLicense, Noti.time)
elseif Config.Framework == "qb" then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameHelicopter] = false
licenseTable[Config.licenseNamePlane] = false
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.PlayerData.citizenid, Config.licenseNameHelicopter, xPlayer.PlayerData.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.PlayerData.citizenid, Config.licenseNamePlane, xPlayer.PlayerData.source)
SqlFunc(Config.Mysql,'execute','DELETE FROM bit_flightschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
notifications(Noti.check, Lang.deletedLicense, Noti.time)
end
end

bit-boatschool​

config.lua
function applyLicense(xPlayer, license)
if Config.Framework == "esx" then
if license == 'OUPV' then
TriggerClientEvent('LicenseManager:addLicense', xPlayer.source, 'water_boat', 'Fahrschule')
elseif license == 'YM' then
TriggerClientEvent('LicenseManager:addLicense', xPlayer.source, 'water_yacht', 'Fahrschule')
end
elseif Config.Framework == "qb" then
if license == 'OUPV' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameBoat] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerClientEvent('LicenseManager:addLicense', xPlayer.PlayerData.source, 'water_boat', 'Fahrschule')
elseif license == 'YM' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameYacht] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerClientEvent('LicenseManager:addLicense', xPlayer.PlayerData.source, 'water_yacht', 'Fahrschule')

end
end
end

function deleteLicense(xPlayer)
if Config.Framework == "esx" then
TriggerEvent('LicenseManager:revokeLicense', xPlayer.identifier, Config.licenseNameBoat, xPlayer.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.identifier, Config.licenseNameYacht, xPlayer.source)
SqlFunc(Config.Mysql,'execute','DELETE FROM bit_boatschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
notifications(Noti.check, Lang.deletedLicense, Noti.time)
elseif Config.Framework == "qb" then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNameBoat] = false
licenseTable[Config.licenseNameYacht] = false
xPlayer.Functions.SetMetaData('licences', licenseTable)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.PlayerData.citizenid, Config.licenseNameBoat, xPlayer.PlayerData.source)
TriggerEvent('LicenseManager:revokeLicense', xPlayer.PlayerData.citizenid, Config.licenseNameYacht, xPlayer.PlayerData.source)
SqlFunc(Config.Mysql,'execute','DELETE FROM bit_boatschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
notifications(Noti.check, Lang.deletedLicense, Noti.time)
end
end

License Manager Config​

bcs_licensemanager/config/licenses.lua
water_boat = {
id_length = 8,
label = "Boating License",
manager = 'dmv',
job = 'police',
validFor = 31,
price = 2500,
lostPrice = 1000
},
water_yacht = {
id_length = 8,
label = "Yacht License",
manager = 'dmv',
job = 'police',
validFor = 31,
price = 2500,
lostPrice = 1000
},
flight_plane = {
id_length = 8,
label = "Private Pilot License",
manager = 'dmv',
job = 'police',
validFor = 31,
price = 2500,
lostPrice = 1000
},
flight_helicopter = {
id_length = 8,
label = "Helicopter License",
manager = 'dmv',
job = 'police',
validFor = 31,
price = 2500,
lostPrice = 1000
},

QB Core Items​

qb-core/shared/items.lua
['water_boat']                  = {['name'] = 'water_boat',                   ['label'] = 'Boat License',            ['weight'] = 0,         ['type'] = 'item',      ['image'] = 'water_boat.png',       ['unique'] = true,      ['useable'] = true,     ['shouldClose'] = false,   ['combinable'] = nil,   ['description'] = 'Permit to show you can operate a boat'},
['water_yacht'] = {['name'] = 'water_yacht', ['label'] = 'Yacht License', ['weight'] = 0, ['type'] = 'item', ['image'] = 'water_yacht.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Permit to show you can operate a yacht'},
['flight_helicopter'] = {['name'] = 'flight_helicopter', ['label'] = 'Helicopter License', ['weight'] = 0, ['type'] = 'item', ['image'] = 'flight_helicopter.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Permit to show you can operate a Helicopter'},
['flight_plane'] = {['name'] = 'flight_plane', ['label'] = 'Private Pilot License', ['weight'] = 0, ['type'] = 'item', ['image'] = 'flight_plane.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Permit to show you car operate a private aircraft'},

Credits to Psycho Sasquatch on discord 😇