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-driverschool:openMenu")

-- Trigger to delete license:
-- TriggerServerEvent("bit-driverschool:deleteLicense", playerID, license)

-- $$$$$$\   $$$$$$\  $$\   $$\ $$$$$$$$\ $$$$$$\  $$$$$$\  $$\   $$\ $$$$$$$\   $$$$$$\ $$$$$$$$\ $$$$$$\  $$$$$$\  $$\   $$\ 
-- $$  __$$\ $$  __$$\ $$$\  $$ |$$  _____|\_$$  _|$$  __$$\ $$ |  $$ |$$  __$$\ $$  __$$\\__$$  __|\_$$  _|$$  __$$\ $$$\  $$ |
-- $$ /  \__|$$ /  $$ |$$$$\ $$ |$$ |        $$ |  $$ /  \__|$$ |  $$ |$$ |  $$ |$$ /  $$ |  $$ |     $$ |  $$ /  $$ |$$$$\ $$ |
-- $$ |      $$ |  $$ |$$ $$\$$ |$$$$$\      $$ |  $$ |$$$$\ $$ |  $$ |$$$$$$$  |$$$$$$$$ |  $$ |     $$ |  $$ |  $$ |$$ $$\$$ |
-- $$ |      $$ |  $$ |$$ \$$$$ |$$  __|     $$ |  $$ |\_$$ |$$ |  $$ |$$  __$$< $$  __$$ |  $$ |     $$ |  $$ |  $$ |$$ \$$$$ |
-- $$ |  $$\ $$ |  $$ |$$ |\$$$ |$$ |        $$ |  $$ |  $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |  $$ |     $$ |  $$ |  $$ |$$ |\$$$ |
-- \$$$$$$  | $$$$$$  |$$ | \$$ |$$ |      $$$$$$\ \$$$$$$  |\$$$$$$  |$$ |  $$ |$$ |  $$ |  $$ |   $$$$$$\  $$$$$$  |$$ | \$$ |
-- \______/  \______/ \__|  \__|\__|      \______| \______/  \______/ \__|  \__|\__|  \__|  \__|   \______| \______/ \__|  \__|

-- 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.licenseAprice = 2500
-- B license price
Config.licenseBprice = 5500
-- C license price
Config.licenseCprice = 10000
-- 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 = 120
-- Maximum speed in the city
Config.urbanSpeed = 60
-- 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 = 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 = false

-- $$\   $$\ $$$$$$$$\ $$\     $$\  $$$$$$\  
-- $$ | $$  |$$  _____|\$$\   $$  |$$  __$$\ 
-- $$ |$$  / $$ |       \$$\ $$  / $$ /  \__|
-- $$$$$  /  $$$$$\      \$$$$  /  \$$$$$$\  
-- $$  $$<   $$  __|      \$$  /    \____$$\ 
-- $$ |\$$\  $$ |          $$ |    $$\   $$ |
-- $$ | \$$\ $$$$$$$$\     $$ |    \$$$$$$  |
-- \__|  \__|\________|    \__|     \______/

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

-- $$\    $$\ $$$$$$$$\ $$\   $$\ $$$$$$\  $$$$$$\  $$\       $$$$$$$$\  $$$$$$\  
-- $$ |   $$ |$$  _____|$$ |  $$ |\_$$  _|$$  __$$\ $$ |      $$  _____|$$  __$$\ 
-- $$ |   $$ |$$ |      $$ |  $$ |  $$ |  $$ /  \__|$$ |      $$ |      $$ /  \__|
-- \$$\  $$  |$$$$$\    $$$$$$$$ |  $$ |  $$ |      $$ |      $$$$$\    \$$$$$$\  
-- \$$\$$  / $$  __|   $$  __$$ |  $$ |  $$ |      $$ |      $$  __|    \____$$\ 
-- \$$$  /  $$ |      $$ |  $$ |  $$ |  $$ |  $$\ $$ |      $$ |      $$\   $$ |
-- \$  /   $$$$$$$$\ $$ |  $$ |$$$$$$\ \$$$$$$  |$$$$$$$$\ $$$$$$$$\ \$$$$$$  |
-- \_/    \________|\__|  \__|\______| \______/ \________|\________| \______/

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'
Receptionist.x = 214.45
Receptionist.y = -1400.163
Receptionist.z = 29.57
Receptionist.heading = 317.48

PracticeInstructor.use = true
PracticeInstructor.npc = 'csb_trafficwarden'
PracticeInstructor.x = 219.95
PracticeInstructor.y = -1398.27
PracticeInstructor.z = 30.20
PracticeInstructor.heading = 334.48
-- if you want the npc to spawn directly inside the vehicle
PracticeInstructor.useTeleport = false

TheoricalInstructor.npc = 'csb_reporter'
TheoricalInstructor.x = 208.69
TheoricalInstructor.y = -1382.96
TheoricalInstructor.z = 29.57
TheoricalInstructor.heading = 130.39

TheoricalUserPosition.x = 207.40
TheoricalUserPosition.y = -1384.23
TheoricalUserPosition.z = 29.57
TheoricalUserPosition.heading = 314.64

-- $$\   $$\  $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\  $$$$$$\   $$$$$$\ $$$$$$$$\ $$$$$$\  $$$$$$\  $$\   $$\  $$$$$$\  
-- $$$\  $$ |$$  __$$\\__$$  __|\_$$  _|$$  _____|\_$$  _|$$  __$$\ $$  __$$\\__$$  __|\_$$  _|$$  __$$\ $$$\  $$ |$$  __$$\ 
-- $$$$\ $$ |$$ /  $$ |  $$ |     $$ |  $$ |        $$ |  $$ /  \__|$$ /  $$ |  $$ |     $$ |  $$ /  $$ |$$$$\ $$ |$$ /  \__|
-- $$ $$\$$ |$$ |  $$ |  $$ |     $$ |  $$$$$\      $$ |  $$ |      $$$$$$$$ |  $$ |     $$ |  $$ |  $$ |$$ $$\$$ |\$$$$$$\  
-- $$ \$$$$ |$$ |  $$ |  $$ |     $$ |  $$  __|     $$ |  $$ |      $$  __$$ |  $$ |     $$ |  $$ |  $$ |$$ \$$$$ | \____$$\ 
-- $$ |\$$$ |$$ |  $$ |  $$ |     $$ |  $$ |        $$ |  $$ |  $$\ $$ |  $$ |  $$ |     $$ |  $$ |  $$ |$$ |\$$$ |$$\   $$ |
-- $$ | \$$ | $$$$$$  |  $$ |   $$$$$$\ $$ |      $$$$$$\ \$$$$$$  |$$ |  $$ |  $$ |   $$$$$$\  $$$$$$  |$$ | \$$ |\$$$$$$  |
-- \__|  \__| \______/   \__|   \______|\__|      \______| \______/ \__|  \__|  \__|   \______| \______/ \__|  \__| \______/

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

-- $$$$$$$\  $$\       $$$$$$\ $$$$$$$\   $$$$$$\  
-- $$  __$$\ $$ |      \_$$  _|$$  __$$\ $$  __$$\ 
-- $$ |  $$ |$$ |        $$ |  $$ |  $$ |$$ /  \__|
-- $$$$$$$\ |$$ |        $$ |  $$$$$$$  |\$$$$$$\  
-- $$  __$$\ $$ |        $$ |  $$  ____/  \____$$\ 
-- $$ |  $$ |$$ |        $$ |  $$ |      $$\   $$ |
-- $$$$$$$  |$$$$$$$$\ $$$$$$\ $$ |      \$$$$$$  |
-- \_______/ \________|\______|\__|       \______/

Blips.active = true
Blips.coord = {
    x = 214.45,
    y = -1400.163,
    z = 30.57
}
Blips.blip = 227
Blips.blipColor = 2
Blips.blipScale = 0.9
Blips.blipText = "Driver School"

-- $$\      $$\  $$$$$$\  $$$$$$$\  $$\   $$\ $$$$$$$$\ $$$$$$$\   $$$$$$\  
-- $$$\    $$$ |$$  __$$\ $$  __$$\ $$ | $$  |$$  _____|$$  __$$\ $$  __$$\ 
-- $$$$\  $$$$ |$$ /  $$ |$$ |  $$ |$$ |$$  / $$ |      $$ |  $$ |$$ /  \__|
-- $$\$$\$$ $$ |$$$$$$$$ |$$$$$$$  |$$$$$  /  $$$$$\    $$$$$$$  |\$$$$$$\  
-- $$ \$$$  $$ |$$  __$$ |$$  __$$< $$  $$<   $$  __|   $$  __$$<  \____$$\ 
-- $$ |\$  /$$ |$$ |  $$ |$$ |  $$ |$$ |\$$\  $$ |      $$ |  $$ |$$\   $$ |
-- $$ | \_/ $$ |$$ |  $$ |$$ |  $$ |$$ | \$$\ $$$$$$$$\ $$ |  $$ |\$$$$$$  |
-- \__|     \__|\__|  \__|\__|  \__|\__|  \__|\________|\__|  \__| \______/

Marker = {
    x = 214.45,
    y = -1400.163,
    z = 30.57,
    mtype = 23,
    -- RGB COLOR:
    r = 245,
    g = 14,
    b = 70,
    -- DISTANCE AND SIZE:
    dis = 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"

-- $$$$$$$$\ $$\   $$\ $$\   $$\  $$$$$$\ $$$$$$$$\ $$$$$$\  $$$$$$\  $$\   $$\  $$$$$$\  
-- $$  _____|$$ |  $$ |$$$\  $$ |$$  __$$\\__$$  __|\_$$  _|$$  __$$\ $$$\  $$ |$$  __$$\ 
-- $$ |      $$ |  $$ |$$$$\ $$ |$$ /  \__|  $$ |     $$ |  $$ /  $$ |$$$$\ $$ |$$ /  \__|
-- $$$$$\    $$ |  $$ |$$ $$\$$ |$$ |        $$ |     $$ |  $$ |  $$ |$$ $$\$$ |\$$$$$$\  
-- $$  __|   $$ |  $$ |$$ \$$$$ |$$ |        $$ |     $$ |  $$ |  $$ |$$ \$$$$ | \____$$\ 
-- $$ |      $$ |  $$ |$$ |\$$$ |$$ |  $$\   $$ |     $$ |  $$ |  $$ |$$ |\$$$ |$$\   $$ |
-- $$ |      \$$$$$$  |$$ | \$$ |\$$$$$$  |  $$ |   $$$$$$\  $$$$$$  |$$ | \$$ |\$$$$$$  |
-- \__|       \______/ \__|  \__| \______/   \__|   \______| \______/ \__|  \__| \______/

-- 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" 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)
        elseif license == 'C' then
            local licenseTable = xPlayer.PlayerData.metadata['licences']
            licenseTable[Config.licenseNameTruck] = true
            xPlayer.Functions.SetMetaData('licences', licenseTable)
        end
    end
end

function deleteLicense(xPlayer)
    if Config.Framework == "esx" then
        SqlFunc(Config.Mysql, 'execute', 'DELETE FROM bit_driverschool WHERE userIdentifier = @userIdentifier', {
            ['@userIdentifier'] = xPlayer.identifier
        })
        SqlFunc(Config.Mysql, 'execute',
            'DELETE FROM user_licenses WHERE owner = @owner and type = ' .. Config.licenseNameMoto .. ' or type = ' ..
                Config.licenseNameCar .. ' or type = ' .. Config.licenseNameTruck, {
                ['@owner'] = 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)
        SqlFunc(Config.Mysql, 'execute', 'DELETE FROM bit_driverschool WHERE userIdentifier = @userIdentifier', {
            ['@userIdentifier'] = xPlayer.identifier
        })
        notifications(Noti.check, Lang.deletedLicense, Noti.time)
    end
end

Last updated