INSTALLATION
1. DOWNLOAD
The first step is to download the product we have just purchased. To do this we will go to our KEYMASTER account and search for "Buty-FlightSchool".
2. DEPENDENCIES AND INSTALLATION
This script does not need any dependencies or progress bar.
Just place the script under your CORE and your core scripts:
ensure Buty-FlightSchool
And when you have everything clean without another Boat School script, you will have to install the Buty-FlightSchool SQL.
3. CONFIG
The following will explain all the settings, one of the most important things that I recommend you spend a few minutes to understand in order to offer your users the best possible experien
The SERVER > OPEN is where you have to configure the correct event/export that your license system uses.
If you use the DEFAULT of ESX/QB you don't have to touch anything, the same if you use the Buty-License you only have to activate it in the CONFIG.
Framework = {
FrameworkName = 'esx', -- esx or qb
FileName = 'es_extended', -- es_extended / qb-core
SQLWrapper = 'oxmysql', -- oxmysql / mysql-async / ghmattimysql
UseButyLicense = true, -- true / false -> https://butycall.tebex.io/package/5743295
}
Prices = {
PaymentMethod = 'bank', -- bank / cash
Airplane = { Theoretical = 10000, Practical = 10000 },
Helicopter = { Theoretical = 20000, Practical = 20000 }
}
NPC = {
Position = vector4(-1032.923096, -3015.942871, 12.946533, 59.527554),
Model = 's_m_m_pilot_01'
}
Blip = {
Sprite = 423,
Color = 38,
Scale = 1.0,
Label = 'Flight School'
}
TheoreticalExam = {
MistakeMax = 2,
ExamTime = 2.5, -- In minutes
Questions = {
airplane = {
{
Question = 'What is the most important part of an airplane?',
Answers = {
{ Text = 'The wings', Right = true },
{ Text = 'The engine', Right = false },
{ Text = 'The pilot', Right = false }
}
},
{
Question = 'What is the worst time to fly?',
Answers = {
{ Text = 'In a storm', Right = true },
{ Text = 'On a clear day', Right = false },
{ Text = 'On a starry night', Right = false }
}
},
{
Question = 'What is the most dangerous animal for an airplane?',
Answers = {
{ Text = 'A bird', Right = true },
{ Text = 'A bat', Right = false },
{ Text = 'An elephant', Right = false }
}
},
{
Question = 'What is the difference between a jet and a turboprop airplane?',
Answers = {
{ Text = 'A jet airplane uses jet engines to generate thrust, while a turboprop airplane uses propeller engines to generate thrust.', Right = true },
{ Text = 'A jet airplane is faster and more efficient than a turboprop airplane, but it is also more expensive', Right = false },
{ Text = 'A turboprop airplane is slower and less efficient than a jet airplane, but it is also cheaper', Right = false }
}
},
{
Question = 'What is the worst place to sit on an airplane?',
Answers = {
{ Text = 'Next to the bathroom', Right = true },
{ Text = 'Next to a baby', Right = true },
{ Text = 'Next to a talkative person', Right = false }
}
},
{
Question = 'What is the importance of flaps on an airplane?',
Answers = {
{ Text = 'Flaps help to increase the lift of the wings, which allows the airplane to land and take off at lower speeds.', Right = true },
{ Text = 'Flaps also help to improve the maneuverability of the airplane in crosswind conditions.', Right = false },
{ Text = 'Flaps can be operated manually or automatically by the pilot.', Right = false }
}
},
{
Question = 'What is the most common cause of airplane accidents?',
Answers = {
{ Text = 'Pilot error', Right = true },
{ Text = 'Mechanical failure', Right = false },
{ Text = 'Weather', Right = false }
}
},
{
Question = 'What is the maximum altitude that a commercial airliner can fly?',
Answers = {
{ Text = '35,000 feet', Right = true },
{ Text = '40,000 feet', Right = false },
{ Text = '45,000 feet', Right = false }
}
}
},
helicopter = {
{
Question = 'What is the primary purpose of the tail rotor on a helicopter?',
Answers = {
{ Text = 'To make the helicopter look cooler', Right = false },
{ Text = 'To provide forward thrust', Right = false },
{ Text = 'To counteract the torque generated by the main rotor', Right = true }
}
},
{
Question = 'How do you communicate with the control tower while flying?',
Answers = {
{ Text = 'Using hand gestures and winks', Right = false },
{ Text = 'Via telepathy', Right = false },
{ Text = 'Using the aircrafts radio', Right = true }
}
},
{
Question = 'During autorotation, what is the primary source of power to keep the main rotor spinning?',
Answers = {
{ Text = 'Engine power', Right = false },
{ Text = 'Air flowing through the rotor blades', Right = true },
{ Text = 'Helicopters battery', Right = false }
}
},
{
Question = 'What do you call a helicopter that doesnt want to work?',
Answers = {
{ Text = 'Rafael', Right = false },
{ Text = 'AviÃŗn', Right = false },
{ Text = 'A hellino-copter', Right = true }
}
},
{
Question = 'Which flight maneuver is used to make a rapid 180-degree turn without changing the helicopters altitude?',
Answers = {
{ Text = 'Stall Turn', Right = false },
{ Text = 'Barrel Roll', Right = false },
{ Text = 'Pirouette', Right = true }
}
},
{
Question = 'Why did the helicopter go to therapy?',
Answers = {
{ Text = 'It had rotor issues', Right = false },
{ Text = 'To cope with height anxiety', Right = false },
{ Text = 'For some "helico-therapy"', Right = true }
}
},
{
Question = 'What is the purpose of the cyclic control in a helicopter?',
Answers = {
{ Text = 'To control engine power', Right = false },
{ Text = 'To adjust the pitch of the main rotor blades', Right = true },
{ Text = 'To synchronize the tail rotor', Right = false }
}
},
{
Question = 'What is the name of the rotating blades on top of a helicopter?',
Answers = {
{ Text = 'Helicopter wings', Right = false },
{ Text = 'Helicopter fans', Right = false },
{ Text = 'Helicopter rotor blades', Right = true }
}
}
}
}
}
PracticalExam = {
MissionTime = 10, -- In minutes
PlaneModel = 'lazer',
HelicopterModel = 'frogger',
VehiclePlate = 'Flight School',
SpawnCoords = {
vector4(-880.391235, -3212.017578, 13.929688, 56.692913),
vector4(-1053.08, -3021.68, 13.96, 56.64)
},
CheckpointMarker = { Type = 6, Size = 25.0, Color = { 47, 92, 115, 255 } },
Texts = {
-- First mission
[1] = 'Take off and fly the aircraft through the marker',
-- Second mission
[2] = 'Fly the aircraft through all the markers',
-- Third mission
[3] = 'Land the aircraft in the marker'
},
Routes = {
airplane = {
{
-- First mission
{
{ Pos = vector3(-1478.29, -2867.07, 50.96) }
},
-- Second mission
{
{ Pos = vector3(-1985.79, -2583.05, 208.94) },
{ Pos = vector3(-3807.71, 19.63, 410.03) },
{ Pos = vector3(-3267.47, 2473.18, 477.76) },
{ Pos = vector3(-615.01, 2543.81, 564.87) },
{ Pos = vector3(284.09, 2827.10, 238.94) },
{ Pos = vector3(579.14, 2912.26, 169.19) },
{ Pos = vector3(853.16, 2995.65, 107.86) },
{ Pos = vector3( 997.62, 3059.63, 57.99) }
},
-- Third mission
{
{ Pos = vector3(1274.31, 3135.83, 40.41) }
}
}
},
helicopter = {
{
-- First mission
{
{ Pos = vector3(-1478.29, -2867.07, 50.96) }
},
-- Second mission
{
{ Pos = vector3(-1985.79, -2583.05, 208.94) },
{ Pos = vector3(-3807.71, 19.63, 410.03) },
{ Pos = vector3(-3267.47, 2473.18, 477.76) },
{ Pos = vector3(-615.01, 2543.81, 564.87) },
{ Pos = vector3(284.09, 2827.10, 238.94) },
{ Pos = vector3(579.14, 2912.26, 169.19) },
{ Pos = vector3(853.16, 2995.65, 107.86) },
{ Pos = vector3( 997.62, 3059.63, 57.99) }
},
-- Third mission
{
{ Pos = vector3(1274.31, 3135.83, 40.41) }
}
}
}
}
}
Translation = {
OpenMenu = '~w~PRESS ~ub~[E]~wu~ ~w~to open the flight school',
NotEnoughMoney = 'You don\'t have enough money'
}
This SCRIPT does not need many open functions since everything is already self-configured.
It is recommended that many of the modifications to the OPENFUNCTION files be made by a programmer with LUA and FiveM ideas.
-- Triggered when the practical exam vehicle was spawned
-- vehicle = the vehicle handle
function VehicleSpawned(vehicle)
end
-- Triggered before the script deletes the mission vehicle
-- vehicle = the vehicle handle
function VehicleDeleted(vehicle)
end
-- Triggered when the player died while in mission
-- If you are using the default esx_ambulancejob or qb-ambulancejob then leave it blank
function RevivePlayer()
end
function Text(text,coords)
local dist = Vdist(coords.x,coords.y,coords.z,GetEntityCoords(PlayerPedId(-1)))
if dist < 1.5 then
DrawText3Ds(coords.x,coords.y,coords.z + 1.05,text, 0, 0.1, 0.1,255)
else
DrawText3Ds(coords.x,coords.y,coords.z + 1.05,text, 0, 0.1, 0.1,100)
end
end
function DrawText3Ds(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
SetDrawOrigin(x,y,z, 0)
DrawText(0.0, 0.0)
ClearDrawOrigin()
end
-- Triggered when player passed the theoretical / practical exam
-- source = player id
-- license = license type (airplane, helicopter)
-- exam = exap type (theoretical, practical)
function AddLicense(source, license, exam)
if ESX then
if exam == "practical" then
TriggerEvent('esx_license:addLicense', source, license, function() end)
end
elseif QBCore then
local qbPlayer = QBCore.Functions.GetPlayer(source)
if exam == "practical" then
if qbPlayer.PlayerData.source ~= nil then
local licenseTable = qbPlayer.PlayerData.metadata['licences']
licenseTable[license] = true
qbPlayer.Functions.SetMetaData('licences', licenseTable)
qbPlayer.Functions.Save()
end
end
end
end
-- Triggered when notification needs to be shown
-- source = player id
-- text = notification text
function Notification(source, text)
end
If you want to edit the aesthetics or design. You have the HTML open so you can modify the style and everything as you want.
The script is RESPONSIVE for all resolutions as well.
Last updated