Configuration
Don't touch this line
Config, Blips, Lang, Noti, Vehicles, TheoricalInstructor, PracticeInstructor, TheoricalUserPosition, Receptionist = {},
{}, {}, {}, {}, {}, {}, {}, {}
CONFIGURATION FILE
Config, Blips, Lang, Noti, Vehicles, TheoricalInstructor, PracticeInstructor, TheoricalUserPosition, Receptionist = {},
{}, {}, {}, {}, {}, {}, {}, {}
-- Trigger to open menu:
-- TriggerClientEvent("bit-flightschool:openMenu")
-- Trigger to delete license:
-- TriggerServerEvent("bit-flightschool:deleteLicense", playerID, license)
-- a88888b. .88888. 888888ba 88888888b dP .88888. dP dP 888888ba .d888888 d888888P dP .88888. 888888ba
-- d8' `88 d8' `8b 88 `8b 88 88 d8' `88 88 88 88 `8b d8' 88 88 88 d8' `8b 88 `8b
-- 88 88 88 88 88 a88aaaa 88 88 88 88 a88aaaa8P' 88aaaaa88a 88 88 88 88 88 88
-- 88 88 88 88 88 88 88 88 YP88 88 88 88 `8b. 88 88 88 88 88 88 88 88
-- Y8. .88 Y8. .8P 88 88 88 88 Y8. .88 Y8. .8P 88 88 88 88 88 88 Y8. .8P 88 88
-- Y88888P' `8888P' dP dP dP dP `88888' `Y88888P' dP dP 88 88 dP dP `8888P' dP dP
-- Use "esx" or "qb"
Config.Framework = "qb"
-- If you are using one of the most recent versions of ESX, set the script name. Default = "es_extended"
Config.ESXExport = ""
-- Default ESX: "esx:getSharedObject" | Default QB: "qb-core"
Config.Core = "qb-core"
-- oxmysql, mysql-async or ghmattisql
Config.Mysql = "oxmysql"
-- A license price
Config.licenseHelicopterPrice = 2500
-- B license price
Config.licensePlanePrice = 5500
-- Number of questions for the theoretical test
Config.theoricalTotalQuestions = 9
-- Answers needed to pass the theory test
Config.correctAnswersNeeded = 5
-- Helicopter license name in the database
Config.licenseNameHelicopter = 'helicopter'
-- Plane license name in the database
Config.licenseNamePlane = 'plane'
-- Instructor audio language. Change it or replace the files in the audio folder
Config.TTSLanguage = 'EN'
-- Maximum number of errors that can be made in the practical test
Config.MaxErrorsPractice = 5
-- Font used in alerts. Set to 0 if your language is Chinese
Config.alertTextFont = 4
-- Set to true if you want to use ESX.DeleteVehicle or QBCore.Functions.DeleteVehicle. If set to false, the native function will be used.
Config.UseEsxQBDeleteVehicle = false
-- Check license in the database
Config.checkDBLicense = true
-- Teleport the user to the driving school if he fails the practical test
Config.teleportIfFails = true
-- Coordinates to teleport the user if fails the practical test
Config.teleportIfFailsCoord = vector3(-1187.21, -2423.52, 20.26)
-- Check if there is a vehicle at spawn point
Config.checkspawnpoint = true
-- Account to which you want the money to be charged
Config.accountToRemoveMoney = "bank"
-- Set to true if you want users to have to repeat the theory for each license
Config.repeatTheorical = true
-- dP dP 88888888b dP dP .d88888b
-- 88 .d8' 88 Y8. .8P 88. "'
-- 88aaa8P' a88aaaa Y8aa8P `Y88888b.
-- 88 `8b. 88 88 `8b
-- 88 88 88 88 d8' .8P
-- dP dP 88888888P dP Y88888P
Config.useKeys = true
function addKeys(vehicle)
-- Insert here your trigger. EX:
-- TriggerServerEvent("keyscar:server:addKey", GetVehicleNumberPlateText(vehicle), false)
end
function removeKeys(vehicle, plate)
if vehicle ~= 0 and plate ~= nil then
-- Insert here your trigger
end
end
-- dP dP 88888888b dP dP dP a88888b. dP 88888888b .d88888b
-- 88 88 88 88 88 88 d8' `88 88 88 88. "'
-- 88 .8P a88aaaa 88aaaaa88a 88 88 88 a88aaaa `Y88888b.
-- 88 d8' 88 88 88 88 88 88 88 `8b
-- 88 .d8P 88 88 88 88 Y8. .88 88 88 d8' .8P
-- 888888' 88888888P dP dP dP Y88888P' 88888888P 88888888P Y88888P
Vehicles.helicopter = 'supervolito'
Vehicles.plane = 'velum2'
Vehicles.spawn = {
x = -1118.94,
y = -2398.03,
z = 13.95,
heading = 145.69
}
-- 88888888b dP dP 88888888b dP
-- 88 88 88 88 88
-- a88aaaa 88 88 a88aaaa 88
-- 88 88 88 88 88
-- 88 Y8. .8P 88 88
-- dP `Y88888P' 88888888P 88888888P
-- set to true if you want to use a custom fuel script
Config.useCustomFuel = false
function setFuel(vehicle)
end
-- 888888ba 888888ba a88888b.
-- 88 `8b 88 `8b d8' `88
-- 88 88 a88aaaa8P' 88
-- 88 88 88 88
-- 88 88 88 Y8. .88
-- dP dP dP Y88888P'
Receptionist.npc = 's_f_y_airhostess_01'
Receptionist.x = -1189.84
Receptionist.y = -2425.32
Receptionist.z = 20.26
Receptionist.heading = 331.72
PracticeInstructor.use = true
PracticeInstructor.npc = 's_m_m_pilot_01'
PracticeInstructor.x = -1094.09
PracticeInstructor.y = -2402.76
PracticeInstructor.z = 13.95
PracticeInstructor.heading = 112.36
-- if you want the npc to spawn directly inside the vehicle
PracticeInstructor.useTeleport = false
TheoricalInstructor.npc = 'csb_reporter'
TheoricalInstructor.x = 0.0
TheoricalInstructor.y = 0.0
TheoricalInstructor.z = 0.0
TheoricalInstructor.heading = 0.0
TheoricalUserPosition.x = -1188.48
TheoricalUserPosition.y = -2424.09
TheoricalUserPosition.z = 20.26
TheoricalUserPosition.heading = 46.49
-- 888888ba .88888. d888888P dP 88888888b dP a88888b. .d888888 d888888P dP .88888. 888888ba .d88888b
-- 88 `8b d8' `8b 88 88 88 88 d8' `88 d8' 88 88 88 d8' `8b 88 `8b 88. "'
-- 88 88 88 88 88 88 a88aaaa 88 88 88aaaaa88a 88 88 88 88 88 88 `Y88888b.
-- 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 `8b
-- 88 88 Y8. .8P 88 88 88 88 Y8. .88 88 88 88 88 Y8. .8P 88 88 d8' .8P
-- dP dP `8888P' dP dP dP dP Y88888P' 88 88 dP dP `8888P' dP dP Y88888P
function notifications(notitype, message, time)
-- Change this trigger for your notification system keeping the variables
TriggerEvent('codem-notification', message, time, notitype)
end
-- Notifications types:
Noti.info = 'info'
Noti.check = 'check'
Noti.error = 'error'
-- Notification time:
Noti.time = 5000
-- 888888ba dP dP 888888ba .d88888b
-- 88 `8b 88 88 88 `8b 88. "'
-- a88aaaa8P' 88 88 a88aaaa8P' `Y88888b.
-- 88 `8b. 88 88 88 `8b
-- 88 .88 88 88 88 d8' .8P
-- 88888888P 88888888P dP dP Y88888P
Blips.active = true
Blips.coord = {
x = -1187.21,
y = -2423.52,
z = 20.26
}
Blips.blip = 43
Blips.blipColor = 2
Blips.blipScale = 0.9
Blips.blipText = "Flight School"
-- 8888ba.88ba .d888888 888888ba dP dP 88888888b 888888ba .d88888b
-- 88 `8b `8b d8' 88 88 `8b 88 .d8' 88 88 `8b 88. "'
-- 88 88 88 88aaaaa88a a88aaaa8P' 88aaa8P' a88aaaa a88aaaa8P' `Y88888b.
-- 88 88 88 88 88 88 `8b. 88 `8b. 88 88 `8b. `8b
-- 88 88 88 88 88 88 88 88 88 88 88 88 d8' .8P
-- dP dP dP 88 88 dP dP dP dP 88888888P dP dP Y88888P
Marker = {
x = -1189.84,
y = -2425.32,
z = 20.26,
mtype = 23,
-- RGB COLOR:
r = 39,
g = 233,
b = 140,
-- DISTANCE AND SIZE:
dis = 3,
size = 2.0
}
-- 888888ba .88888. dP dP d888888P 88888888b
-- 88 `8b d8' `8b 88 88 88 88
-- a88aaaa8P' 88 88 88 88 88 a88aaaa
-- 88 `8b. 88 88 88 88 88 88
-- 88 88 Y8. .8P Y8. .8P 88 88
-- dP dP `8888P' `Y88888P' dP 88888888P
Routes = {
[1] = {
x = -1863.05,
y = -3156.43,
z = 168.62
},
[2] = {
x = -1644.53,
y = -4063.29,
z = 118.68
},
[3] = {
x = -314.78,
y = -3890.55,
z = 48.82
},
[4] = {
x = 231.86,
y = -3131.62,
z = 103.97
},
[5] = {
x = 158.99,
y = -2370.2,
z = 77.14
},
[6] = {
x = -218.29,
y = -1030.53,
z = 163.41
},
[7] = {
x = -910.43,
y = -689.12,
z = 180.54
},
[8] = {
x = -1136.4,
y = -1860.88,
z = 79.1
},
[9] = {
x = -1421.39,
y = -2357.71,
z = 15.56
}
}
-- .88888. dP dP 88888888b .d88888b d888888P dP .88888. 888888ba .d88888b
-- d8' `8b 88 88 88 88. "' 88 88 d8' `8b 88 `8b 88. "'
-- 88 88 88 88 a88aaaa `Y88888b. 88 88 88 88 88 88 `Y88888b.
-- 88 db 88 88 88 88 `8b 88 88 88 88 88 88 `8b
-- Y8. Y88P Y8. .8P 88 d8' .8P 88 88 Y8. .8P 88 88 d8' .8P
-- `8888PY8b `Y88888P' 88888888P Y88888P dP dP `8888P' dP dP Y88888P
Questions = {
['What should you do if you see a stop sign?'] = {
[1] = 'Come to a complete stop and yield the right-of-way',
[2] = 'Speed up to impress pedestrians',
[3] = 'Take a quick selfie for Instagram',
['correct'] = 1,
['index'] = 1
},
['What is the speed limit in a school zone?'] = {
[1] = 'Light speed, so as not to be late',
[2] = 'The one indicated by the traffic signs',
[3] = ' It depends on how late you arrive to class',
['correct'] = 2,
['index'] = 2
},
['What do you do if a traffic light is red?'] = {
[1] = 'Check if you have new likes on social media',
[2] = 'Take the opportunity to practice your guitar solo',
[3] = 'Come to a complete stop',
['correct'] = 3,
['index'] = 3
},
['When should you wear your seat belt?'] = {
[1] = 'When you remember that it is fashionable',
[2] = 'Whenever the vehicle is in motion',
[3] = 'Only when visiting the solar system',
['correct'] = 2,
['index'] = 4
},
['What are turn signals used for?'] = {
[1] = 'To start an impromptu car party',
[2] = 'To signal that you ve found a great song on the radio',
[3] = 'To indicate that you are going to turn or change lanes',
['correct'] = 3,
['index'] = 5
},
['How should you react to a pedestrian at a crosswalk?'] = {
[1] = 'Ask him if he knows the directions to Narnia',
[2] = 'Challenge him to a race',
[3] = 'Give way',
['correct'] = 3,
['index'] = 6
},
['What should you do when you hear an emergency siren?'] = {
[1] = 'Move to the nearest lane and stop if necessary',
[2] = 'Increase the volume of the music',
[3] = 'Look for where the free ice cream is coming from',
['correct'] = 1,
['index'] = 7
},
['What is the correct procedure for parallel parking?'] = {
[1] = 'Wait for someone to do it for you',
[2] = 'Slow down, signal and park carefully',
[3] = 'Leave the car in the middle of the street and hope for the best',
['correct'] = 2,
['index'] = 8
},
['What does a flashing yellow traffic light mean?'] = {
[1] = 'It is time for a selfie with speed effect',
[2] = 'Proceed with caution',
[3] = 'The disco is open',
['correct'] = 2,
['index'] = 9
}
}
-- dP .d888888 888888ba .88888. dP dP .d888888 .88888. 88888888b
-- 88 d8' 88 88 `8b d8' `88 88 88 d8' 88 d8' `88 88
-- 88 88aaaaa88a 88 88 88 88 88 88aaaaa88a 88 a88aaaa
-- 88 88 88 88 88 88 YP88 88 88 88 88 88 YP88 88
-- 88 88 88 88 88 Y8. .88 Y8. .8P 88 88 Y8. .88 88
-- 88888888P 88 88 dP dP `88888' `Y88888P' 88 88 `88888' 88888888P
Lang.theoricalneeded = "You must take the theoretical test before taking the practical test"
Lang.returnvehicule = "Return to the vehicle. The test will be cancelled in 10 seconds"
Lang.testcanceled = "The test has been cancelled. Retest again"
Lang.approved = "Congratulations, you have passed!"
Lang.suspended = "You have failed, you can try again another time."
Lang.passed = "You have already passed this test, you cannot take it again"
Lang.enter = "Press ~g~E~w~ to access the ~g~flight school"
Lang.deletedLicense = "The license has been successfully removed"
Lang.noMoney = "You don't have enough money"
Lang.occupiedSpace = "The space to take the vehicle out of the flight school is occupied"
Config.useCustomDrawTxt = true
function customDrawTxt()
TriggerEvent("bit-interact:Start", "E", "Press to access the flight school")
end
-- 88888888b dP dP 888888ba a88888b. d888888P dP .88888. 888888ba .d88888b
-- 88 88 88 88 `8b d8' `88 88 88 d8' `8b 88 `8b 88. "'
-- a88aaaa 88 88 88 88 88 88 88 88 88 88 88 `Y88888b.
-- 88 88 88 88 88 88 88 88 88 88 88 88 `8b
-- 88 Y8. .8P 88 88 Y8. .88 88 88 Y8. .8P 88 88 d8' .8P
-- dP `Y88888P' dP dP Y88888P' dP dP `8888P' dP dP Y88888P
-- Function to add licenses to the user
function applyLicense(xPlayer, license)
if Config.Framework == "esx" then
if license == 'HPL' then
SqlFunc(Config.Mysql, 'execute', 'INSERT INTO user_licenses (type, owner) VALUES (@type, @owner)', {
['@type'] = Config.licenseNameHelicopter,
['@owner'] = xPlayer.identifier
})
elseif license == 'PPL' then
SqlFunc(Config.Mysql, 'execute', 'INSERT INTO user_licenses (type, owner) VALUES (@type, @owner)', {
['@type'] = Config.licenseNamePlane,
['@owner'] = xPlayer.identifier
})
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)
xPlayer.Functions.AddItem('driver_license', 1)
elseif license == 'PPL' then
local licenseTable = xPlayer.PlayerData.metadata['licences']
licenseTable[Config.licenseNamePlane] = true
xPlayer.Functions.SetMetaData('licences', licenseTable)
end
end
end
function deleteLicense(xPlayer)
if Config.Framework == "esx" then
SqlFunc(Config.Mysql, 'execute', 'DELETE FROM bit_flightschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
SqlFunc(Config.Mysql, 'execute',
'DELETE FROM user_licenses WHERE owner = @owner and type = ' .. Config.licenseNameHelicopter .. ' or type = ' ..
Config.licenseNamePlane, {
['@owner'] = 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)
SqlFunc(Config.Mysql, 'execute', 'DELETE FROM bit_flightschool WHERE userIdentifier = @userIdentifier', {
['@userIdentifier'] = xPlayer.identifier
})
notifications(Noti.check, Lang.deletedLicense, Noti.time)
end
end
Last updated