Files
red-valley/resources/[framework]/[addons]/bit-driverschool/config.lua

533 lines
21 KiB
Lua
Raw Normal View History

2026-03-29 21:41:17 +03:00
Config, Blips, Lang, Noti, Vehicles, TheoricalInstructor, PracticeInstructor, TheoricalUserPosition, Receptionist = {}, {}, {}, {}, {}, {}, {}, {}, {}
-- Trigger to open menu:
-- TriggerClientEvent("bit-driverschool:openMenu")
-- Trigger to delete license:
-- TriggerServerEvent("bit-driverschool:deleteLicense", playerID, license)
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\
-- $$ __$$\ $$ __$$\ $$$\ $$ |$$ _____|\_$$ _|$$ __$$\ $$ | $$ |$$ __$$\ $$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |
-- $$ / \__|$$ / $$ |$$$$\ $$ |$$ | $$ | $$ / \__|$$ | $$ |$$ | $$ |$$ / $$ | $$ | $$ | $$ / $$ |$$$$\ $$ |
-- $$ | $$ | $$ |$$ $$\$$ |$$$$$\ $$ | $$ |$$$$\ $$ | $$ |$$$$$$$ |$$$$$$$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |
-- $$ | $$ | $$ |$$ \$$$$ |$$ __| $$ | $$ |\_$$ |$$ | $$ |$$ __$$< $$ __$$ | $$ | $$ | $$ | $$ |$$ \$$$$ |
-- $$ | $$\ $$ | $$ |$$ |\$$$ |$$ | $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |
-- \$$$$$$ | $$$$$$ |$$ | \$$ |$$ | $$$$$$\ \$$$$$$ |\$$$$$$ |$$ | $$ |$$ | $$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |
-- \______/ \______/ \__| \__|\__| \______| \______/ \______/ \__| \__|\__| \__| \__| \______| \______/ \__| \__|
-- Use "esx", "qb" or "qbox"
Config.Framework = "qb"
-- oxmysql, mysql-async or ghmattisql
Config.Mysql = "oxmysql"
-- A license price
Config.licenseAprice = 100
-- B license price
Config.licenseBprice = 200
-- C license price
Config.licenseCprice = 300
-- Set true if you want use KMH or false if you want to use MPH
Config.useKMH = true
-- Number of questions for the theoretical test
Config.theoricalTotalQuestions = 9
-- Answers needed to pass the theory test
Config.correctAnswersNeeded = 5
-- Motorcycle license name in the database
Config.licenseNameMoto = "moto"
-- Car license name in the database
Config.licenseNameCar = "driver"
-- Truck license name in the database
Config.licenseNameTruck = "truck"
-- Instructor audio language. EN -> English / FR -> French / DE -> German / ES -> Spanish / HUN -> Hungarian
Config.TTSLanguage = "EN"
-- Maximum number of errors that can be made in the practical test
Config.MaxErrorsPractice = 5
-- Maximum highway speed
Config.highwaySpeed = 130
-- Maximum speed in the city
Config.urbanSpeed = 50
-- Maximum speed in interurban areas
Config.interUrbanSpeed = 90
-- 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(222.42, -1393.44, 30.59)
-- Check if there is a vehicle at spawn point
Config.checkspawnpoint = false
-- 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 = false
-- $$\ $$\ $$$$$$$$\ $$\ $$\ $$$$$$\
-- $$ | $$ |$$ _____|\$$\ $$ |$$ __$$\
-- $$ |$$ / $$ | \$$\ $$ / $$ / \__|
-- $$$$$ / $$$$$\ \$$$$ / \$$$$$$\
-- $$ $$< $$ __| \$$ / \____$$\
-- $$ |\$$\ $$ | $$ | $$\ $$ |
-- $$ | \$$\ $$$$$$$$\ $$ | \$$$$$$ |
-- \__| \__|\________| \__| \______/
Config.useKeys = true
function addKeys(playerID, vehicle)
-- Handle both calling conventions: addKeys(vehicle) or addKeys(playerID, vehicle)
if vehicle == nil then
vehicle = playerID
end
if vehicle and DoesEntityExist(vehicle) then
local plate = GetVehicleNumberPlateText(vehicle)
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
exports['qs-vehiclekeys']:GiveKeys(plate, model, true)
SetVehicleEngineOn(vehicle, true, true, false)
end
end
function removeKeys(vehicle, plate)
if vehicle ~= 0 and plate ~= nil then
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
exports['qs-vehiclekeys']:RemoveKeys(plate, model)
end
end
-- $$\ $$\ $$$$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$\ $$$$$$$$\ $$$$$$\
-- $$ | $$ |$$ _____|$$ | $$ |\_$$ _|$$ __$$\ $$ | $$ _____|$$ __$$\
-- $$ | $$ |$$ | $$ | $$ | $$ | $$ / \__|$$ | $$ | $$ / \__|
-- \$$\ $$ |$$$$$\ $$$$$$$$ | $$ | $$ | $$ | $$$$$\ \$$$$$$\
-- \$$\$$ / $$ __| $$ __$$ | $$ | $$ | $$ | $$ __| \____$$\
-- \$$$ / $$ | $$ | $$ | $$ | $$ | $$\ $$ | $$ | $$\ $$ |
-- \$ / $$$$$$$$\ $$ | $$ |$$$$$$\ \$$$$$$ |$$$$$$$$\ $$$$$$$$\ \$$$$$$ |
-- \_/ \________|\__| \__|\______| \______/ \________|\________| \______/
Vehicles.moto = "double"
Vehicles.car = "blista"
Vehicles.truck = "phantom"
Vehicles.spawn = {
x = 224.92,
y = -1379.05,
z = 30.54,
heading = 204.09
}
-- $$$$$$$$\ $$\ $$\ $$$$$$$$\ $$\
-- $$ _____|$$ | $$ |$$ _____|$$ |
-- $$ | $$ | $$ |$$ | $$ |
-- $$$$$\ $$ | $$ |$$$$$\ $$ |
-- $$ __| $$ | $$ |$$ __| $$ |
-- $$ | $$ | $$ |$$ | $$ |
-- $$ | \$$$$$$ |$$$$$$$$\ $$$$$$$$\
-- \__| \______/ \________|\________|
-- set to true if you want to use a custom fuel script
Config.useCustomFuel = false
function setFuel(vehicle)
end
-- $$\ $$\ $$$$$$$\ $$$$$$\ $$\
-- $$$\ $$ |$$ __$$\ $$ __$$\ $ |
-- $$$$\ $$ |$$ | $$ |$$ / \__|\_/$$$$$$$\
-- $$ $$\$$ |$$$$$$$ |$$ | $$ _____|
-- $$ \$$$$ |$$ ____/ $$ | \$$$$$$\
-- $$ |\$$$ |$$ | $$ | $$\ \____$$\
-- $$ | \$$ |$$ | \$$$$$$ | $$$$$$$ |
-- \__| \__|\__| \______/ \_______/
Receptionist = {
npc = "cs_jewelass",
location = vector4(214.45, -1400.163, 29.57, 317.48),
}
PracticeInstructor = {
use = true,
npc = "csb_trafficwarden",
location = vector4(219.95, -1398.27, 30.20, 334.48),
useTeleport = false
}
TheoricalInstructor = {
npc = "csb_reporter",
location = vector4(208.69, -1382.96, 29.57, 130.39),
}
TheoricalUserPosition = {
location = vector4(207.40, -1384.23, 29.57, 314.64),
}
-- $$\ $$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\
-- $$$\ $$ |$$ __$$\\__$$ __|\_$$ _|$$ _____|\_$$ _|$$ __$$\ $$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |$$ __$$\
-- $$$$\ $$ |$$ / $$ | $$ | $$ | $$ | $$ | $$ / \__|$$ / $$ | $$ | $$ | $$ / $$ |$$$$\ $$ |$$ / \__|
-- $$ $$\$$ |$$ | $$ | $$ | $$ | $$$$$\ $$ | $$ | $$$$$$$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |\$$$$$$\
-- $$ \$$$$ |$$ | $$ | $$ | $$ | $$ __| $$ | $$ | $$ __$$ | $$ | $$ | $$ | $$ |$$ \$$$$ | \____$$\
-- $$ |\$$$ |$$ | $$ | $$ | $$ | $$ | $$ | $$ | $$\ $$ | $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |$$\ $$ |
-- $$ | \$$ | $$$$$$ | $$ | $$$$$$\ $$ | $$$$$$\ \$$$$$$ |$$ | $$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |\$$$$$$ |
-- \__| \__| \______/ \__| \______|\__| \______| \______/ \__| \__| \__| \______| \______/ \__| \__| \______/
function notifications(notitype, message, time)
if notitype == "primary" then notitype = "info" end
exports['17mov_Hud']:ShowNotification(message, notitype, 'Scoala Auto', time)
end
-- Notifications types:
Noti.info = "info"
Noti.check = "check"
Noti.error = "error"
-- Notification time:
Noti.time = 5000
-- $$$$$$$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$\
-- $$ __$$\ $$ | \_$$ _|$$ __$$\ $$ __$$\
-- $$ | $$ |$$ | $$ | $$ | $$ |$$ / \__|
-- $$$$$$$\ |$$ | $$ | $$$$$$$ |\$$$$$$\
-- $$ __$$\ $$ | $$ | $$ ____/ \____$$\
-- $$ | $$ |$$ | $$ | $$ | $$\ $$ |
-- $$$$$$$ |$$$$$$$$\ $$$$$$\ $$ | \$$$$$$ |
-- \_______/ \________|\______|\__| \______/
Blips = {
active = true,
coord = vector3(214.45, -1400.163, 30.57),
blip = 227,
blipColor = 2,
blipScale = 0.9,
blipText = "Driver School",
routeColor = 2
}
-- $$\ $$\ $$$$$$\ $$$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$$\ $$$$$$\
-- $$$\ $$$ |$$ __$$\ $$ __$$\ $$ | $$ |$$ _____|$$ __$$\ $$ __$$\
-- $$$$\ $$$$ |$$ / $$ |$$ | $$ |$$ |$$ / $$ | $$ | $$ |$$ / \__|
-- $$\$$\$$ $$ |$$$$$$$$ |$$$$$$$ |$$$$$ / $$$$$\ $$$$$$$ |\$$$$$$\
-- $$ \$$$ $$ |$$ __$$ |$$ __$$< $$ $$< $$ __| $$ __$$< \____$$\
-- $$ |\$ /$$ |$$ | $$ |$$ | $$ |$$ |\$$\ $$ | $$ | $$ |$$\ $$ |
-- $$ | \_/ $$ |$$ | $$ |$$ | $$ |$$ | \$$\ $$$$$$$$\ $$ | $$ |\$$$$$$ |
-- \__| \__|\__| \__|\__| \__|\__| \__|\________|\__| \__| \______/
Marker = {
location = vector3(214.45, -1400.163, 30.57),
mtype = 23,
color = {
r = 245,
g = 14,
b = 70
},
distance = 3,
size = 2.0
}
--$$$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$$$\
--\__$$ __|$$ __$$\ $$ __$$\ $$ __$$\ $$ _____|\__$$ __|
-- $$ | $$ / $$ |$$ | $$ |$$ / \__|$$ | $$ |
-- $$ | $$$$$$$$ |$$$$$$$ |$$ |$$$$\ $$$$$\ $$ |
-- $$ | $$ __$$ |$$ __$$< $$ |\_$$ |$$ __| $$ |
-- $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |
-- $$ | $$ | $$ |$$ | $$ |\$$$$$$ |$$$$$$$$\ $$ |
-- \__| \__| \__|\__| \__| \______/ \________| \__|
Config.useTarget = true
function entityTarget(entity, event)
exports["qb-target"]:AddTargetEntity(
entity,
{
options = {
{
type = "client",
event = event,
icon = "fas fa-box-circle-check",
label = Lang.open
}
},
distance = 3.0
}
)
end
-- $$$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$$$\
-- $$ __$$\ $$ __$$\ $$ | $$ |\__$$ __|$$ _____|
-- $$ | $$ |$$ / $$ |$$ | $$ | $$ | $$ |
-- $$$$$$$ |$$ | $$ |$$ | $$ | $$ | $$$$$\
-- $$ __$$< $$ | $$ |$$ | $$ | $$ | $$ __|
-- $$ | $$ |$$ | $$ |$$ | $$ | $$ | $$ |
-- $$ | $$ | $$$$$$ |\$$$$$$ | $$ | $$$$$$$$\
-- \__| \__| \______/ \______/ \__| \________|
Routes = {
[1] = {
speed = Config.urbanSpeed,
x = 67.72,
y = -1111.93,
z = 27.94
},
[2] = {
speed = Config.urbanSpeed,
x = 645.39,
y = -294.65,
z = 42.29
},
[3] = {
speed = Config.highwaySpeed,
x = 2427.21,
y = 2889.86,
z = 47.83
},
[4] = {
speed = Config.interUrbanSpeed,
x = 1486.3,
y = 2741.52,
z = 36.38
},
[5] = {
speed = Config.interUrbanSpeed,
x = 311.02,
y = 2574.02,
z = 42.65
},
[6] = {
speed = Config.interUrbanSpeed,
x = 594.26,
y = 2186.18,
z = 68.44
},
[7] = {
speed = Config.interUrbanSpeed,
x = -96.34,
y = 1852.26,
z = 197.63
},
[8] = {
speed = Config.urbanSpeed,
x = -43.21,
y = -470.87,
z = 38.96
},
[9] = {
speed = Config.urbanSpeed,
x = 248.29,
y = -1395.82,
z = 29.54
}
}
-- $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\
-- $$ __$$\ $$ | $$ |$$ _____|$$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |$$ __$$\
-- $$ / $$ |$$ | $$ |$$ | $$ / \__| $$ | $$ | $$ / $$ |$$$$\ $$ |$$ / \__|
-- $$ | $$ |$$ | $$ |$$$$$\ \$$$$$$\ $$ | $$ | $$ | $$ |$$ $$\$$ |\$$$$$$\
-- $$ | $$ |$$ | $$ |$$ __| \____$$\ $$ | $$ | $$ | $$ |$$ \$$$$ | \____$$\
-- $$ $$\$$ |$$ | $$ |$$ | $$\ $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |$$\ $$ |
-- \$$$$$$ / \$$$$$$ |$$$$$$$$\ \$$$$$$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |\$$$$$$ |
-- \___$$$\ \______/ \________| \______/ \__| \______| \______/ \__| \__| \______/
-- \___|
Questions = {
["Is it forbidden to perform the reverse maneuver on a highway or freeway?"] = {
[1] = "It can only be performed in cases of urgency, such as missing an exit.",
[2] = "No, it is allowed as long as it does not affect safety.",
[3] = "Yes, always",
["correct"] = 3,
["index"] = 1
},
["What action should we take when a small tear occurs in a tire?"] = {
[1] = "Leave it, as there is no danger of any kind",
[2] = "Immediately take it to a repair shop",
[3] = "Put the spare tire on and drive as many km as needed",
["correct"] = 2,
["index"] = 2
},
["Can the doors of a vehicle be left open while driving?"] = {
[1] = "Yes, but only if the temperature is very high, especially in summer",
[2] = "Yes, it improves the aerodynamics of the vehicle",
[3] = "No, it is prohibited",
["correct"] = 3,
["index"] = 3
},
["When passing near pedestrians on this road, what lateral distance should you leave?"] = {
[1] = "no safety distance is required",
[2] = "1.5 meters or more",
[3] = "just enough not to run over them",
["correct"] = 2,
["index"] = 4
},
["Should we make an injured person walk after an accident?"] = {
[1] = "no, never",
[2] = "yes, but only if nothing is broken",
[3] = "yes, to give it a little air",
["correct"] = 3,
["index"] = 5
},
["Is it advisable to stop and rest during travel?"] = {
[1] = "yes, it is advisable to stop in order to smoke a little marijuana to wake you up.",
[2] = "it is not necessary, that is for the lazy ones.",
[3] = "yes, 20 to 30 minutes of rest every 2 hours of driving.",
["correct"] = 3,
["index"] = 6
},
["can police officers subject a driver to a drug test?"] = {
[1] = "yes, always",
[2] = "no, because I do not smoke or consume anything",
[3] = "yes, but I`ll have to smoke a joint with them",
["correct"] = 1,
["index"] = 7
},
["Can you overtake cyclists?"] = {
[1] = "no, I have to wait behind them until they stop",
[2] = "yes, I can overtake them while keeping a safe distance",
[3] = "yes, and I can push them off the road",
["correct"] = 2,
["index"] = 8
},
["if you are riding a motorcycle and find someone in an accident, what should you do?"] = {
[1] = "carefully put him/her on the motorcycle and take him/her to the hospital",
[2] = "call an ambulance",
[3] = "leave him there, it`s not my problem",
["correct"] = 2,
["index"] = 9
}
}
-- $$\ $$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$$$$$$$\
-- $$ | $$ __$$\ $$$\ $$ |$$ __$$\ $$ | $$ |$$ __$$\ $$ __$$\ $$ _____|
-- $$ | $$ / $$ |$$$$\ $$ |$$ / \__|$$ | $$ |$$ / $$ |$$ / \__|$$ |
-- $$ | $$$$$$$$ |$$ $$\$$ |$$ |$$$$\ $$ | $$ |$$$$$$$$ |$$ |$$$$\ $$$$$\
-- $$ | $$ __$$ |$$ \$$$$ |$$ |\_$$ |$$ | $$ |$$ __$$ |$$ |\_$$ |$$ __|
-- $$ | $$ | $$ |$$ |\$$$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ |
-- $$$$$$$$\ $$ | $$ |$$ | \$$ |\$$$$$$ |\$$$$$$ |$$ | $$ |\$$$$$$ |$$$$$$$$\
-- \________|\__| \__|\__| \__| \______/ \______/ \__| \__| \______/ \________|
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 ~r~E~w~ to access the ~g~driving 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 driving school is occupied"
Lang.open = "Access the driving school"
-- $$$$$$$\ $$$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$$$\ $$\ $$\ $$$$$$$$\
-- $$ __$$\ $$ __$$\ $$ __$$\ $$ | $\ $$ | \__$$ __|$$ _____|$$ | $$ |\__$$ __|
-- $$ | $$ |$$ | $$ |$$ / $$ |$$ |$$$\ $$ | $$ | $$ | \$$\ $$ | $$ |
-- $$ | $$ |$$$$$$$ |$$$$$$$$ |$$ $$ $$\$$ | $$ | $$$$$\ \$$$$ / $$ |
-- $$ | $$ |$$ __$$< $$ __$$ |$$$$ _$$$$ | $$ | $$ __| $$ $$< $$ |
-- $$ | $$ |$$ | $$ |$$ | $$ |$$$ / \$$$ | $$ | $$ | $$ /\$$\ $$ |
-- $$$$$$$ |$$ | $$ |$$ | $$ |$$ / \$$ | $$ | $$$$$$$$\ $$ / $$ | $$ |
-- \_______/ \__| \__|\__| \__|\__/ \__| \__| \________|\__| \__| \__|
Config.useCustomDrawTxt = false
function customDrawTxt()
TriggerEvent("bit-interact:Start", "E", "Press to access the driving school")
end
-- $$$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\
-- $$ _____|$$ | $$ |$$$\ $$ |$$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |$$ __$$\
-- $$ | $$ | $$ |$$$$\ $$ |$$ / \__| $$ | $$ | $$ / $$ |$$$$\ $$ |$$ / \__|
-- $$$$$\ $$ | $$ |$$ $$\$$ |$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |\$$$$$$\
-- $$ __| $$ | $$ |$$ \$$$$ |$$ | $$ | $$ | $$ | $$ |$$ \$$$$ | \____$$\
-- $$ | $$ | $$ |$$ |\$$$ |$$ | $$\ $$ | $$ | $$ | $$ |$$ |\$$$ |$$\ $$ |
-- $$ | \$$$$$$ |$$ | \$$ |\$$$$$$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |\$$$$$$ |
-- \__| \______/ \__| \__| \______/ \__| \______| \______/ \__| \__| \______/
-- Function to add licenses to the user
function applyLicense(xPlayer, license)
if Config.Framework == "esx" then
if license == "A" then
SqlFunc(
Config.Mysql,
"execute",
"INSERT INTO user_licenses (type, owner) VALUES (@type, @owner)",
{
["@type"] = Config.licenseNameMoto,
["@owner"] = xPlayer.identifier
}
)
elseif license == "B" then
SqlFunc(
Config.Mysql,
"execute",
"INSERT INTO user_licenses (type, owner) VALUES (@type, @owner)",
{
["@type"] = Config.licenseNameCar,
["@owner"] = xPlayer.identifier
}
)
elseif license == "C" then
SqlFunc(
Config.Mysql,
"execute",
"INSERT INTO user_licenses (type, owner) VALUES (@type, @owner)",
{
["@type"] = Config.licenseNameTruck,
["@owner"] = xPlayer.identifier
}
)
end
elseif Config.Framework == "qb" or Config.Framework == "qbox" then
if license == "A" then
local licenseTable = xPlayer.PlayerData.metadata["licences"]
licenseTable[Config.licenseNameMoto] = true
xPlayer.Functions.SetMetaData("licences", licenseTable)
xPlayer.Functions.AddItem("driver_license", 1)
elseif license == "B" then
local licenseTable = xPlayer.PlayerData.metadata["licences"]
licenseTable[Config.licenseNameCar] = true
xPlayer.Functions.SetMetaData("licences", licenseTable)
xPlayer.Functions.AddItem("driver_license", 1)
elseif license == "C" then
local licenseTable = xPlayer.PlayerData.metadata["licences"]
licenseTable[Config.licenseNameTruck] = true
xPlayer.Functions.SetMetaData("licences", licenseTable)
xPlayer.Functions.AddItem("driver_license", 1)
end
end
end
-- This function is called after a license is deleted. You can add custom logic here.
-- xPlayer: Player object (ESX or QB/QBox)
-- license: License type being deleted ("A", "B", or "C")
function deleteLicense(xPlayer, license)
-- Add your custom logic here. Example:
-- Remove custom items, send Discord logs, etc.
-- Notification (you can customize or remove this)
notifications(Noti.check, Lang.deletedLicense, Noti.time)
end
-- Make driving school peds passive (invincible + non-combatant)
CreateThread(function()
Wait(8000) -- wait for peds to spawn
local pedLocations = {
Receptionist.location,
PracticeInstructor.location,
TheoricalInstructor.location,
}
local allPeds = GetGamePool('CPed')
for _, ped in ipairs(allPeds) do
if DoesEntityExist(ped) and not IsPedAPlayer(ped) then
local pedCoord = GetEntityCoords(ped)
for _, loc in ipairs(pedLocations) do
local coord = vector3(loc.x, loc.y, loc.z)
if #(pedCoord - coord) < 3.0 then
SetEntityInvincible(ped, true)
SetBlockingOfNonTemporaryEvents(ped, true)
SetPedFleeAttributes(ped, 0, false)
SetPedCombatAttributes(ped, 46, true)
SetPedConfigFlag(ped, 2, true)
SetPedCanRagdoll(ped, false)
break
end
end
end
end
end)