Full View config.routes.lua

Preview File Updated: v1.0.1 - 09.10.2023

Config.PracticalTest = { -- if you don't know what each action does, don't touch it to avoid spoiling the exam route
    [1] = {
        action = function()
            if Config.Examiner.SpokenCommands and driveErrors < Config.MaxDriveErrors then
                SendNUIMessage({action = 'audioTask', filename = ('%s_1.mp3'):format(string.lower(Config.Examiner.SpokenLanguage))})
            end
            while currentExam and driveErrors < Config.MaxDriveErrors do
                local myPed = PlayerPedId()
                local myVehicle = GetVehiclePedIsIn(myPed, false)
                if GetIsVehicleEngineRunning(myVehicle) then
                    FreezeEntityPosition(myVehicle, false)
                    setBlipToPoint(2)
                    SendNUIMessage({action = 'updateTasks', done = 1, id = 1})
                    break
                end
                Citizen.Wait(1)
            end
        end
    },
    [2] = {
        coords = vector3(-259.23, -2809.54, 0.11),
        action = function()
            if Config.Examiner.SpokenCommands and driveErrors < Config.MaxDriveErrors then
                SendNUIMessage({action = 'audioTask', filename = ('%s_2.mp3'):format(string.lower(Config.Examiner.SpokenLanguage))})
            end
            local current = Config.PracticalTest[2]
            local nextpoint = Config.PracticalTest[3].coords
            if currentExam and driveErrors < Config.MaxDriveErrors then
                currentCheckpoint = CreateCheckpoint(Config.Practical['Checkpoint'].id, current.coords.x, current.coords.y, current.coords.z, nextpoint.x, nextpoint.y, nextpoint.z, Config.Practical['Checkpoint'].diameter, Config.Practical['Checkpoint'].rgba[1], Config.Practical['Checkpoint'].rgba[2], Config.Practical['Checkpoint'].rgba[3], Config.Practical['Checkpoint'].rgba[4], false)
            end
            while currentExam and driveErrors < Config.MaxDriveErrors do
                local myPed = PlayerPedId()
                local myVehicle = GetVehiclePedIsIn(myPed, false)
                local myCoords = GetEntityCoords(myVehicle)
                local distance = #(myCoords - current.coords)
                if distance < 8.0 then
                    DeleteCheckpoint(currentCheckpoint)
                    setBlipToPoint(3)
                    PlaySoundFrontend(-1, 'CHECKPOINT_NORMAL', 'HUD_MINI_GAME_SOUNDSET', false)
                    SendNUIMessage({action = 'updateTaskProgress', value = '1', id = 2})
                    break
                end
                Citizen.Wait(1)
            end
        end
    },
    [3] = {...}, -- Here are many more points
}

Last updated