Full View config.routes.lua

Preview File Updated: v1.0.3 - 09.10.2023

Config.PracticalTest = { -- if you don't know what each action does, don't touch it to avoid spoiling the exam route
    ['HELICOPTER'] = {
        [1] = {
            action = function()
                if Config.Examiner.SpokenCommands and driveErrors < Config.MaxDriveErrors then
                    SendNUIMessage({action = 'audioTask', filename = ('helicopter.%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)
                        SendNUIMessage({action = 'updateTasks', done = 1, id = 1})
                        break
                    end
                    Citizen.Wait(1)
                end
            end
        },
        [2] = {
            action = function()
                local startHeight = GetEntityCoords(GetVehiclePedIsIn(PlayerPedId(), false))
                if Config.Examiner.SpokenCommands and driveErrors < Config.MaxDriveErrors then
                    SendNUIMessage({action = 'audioTask', filename = ('helicopter.%s_2.mp3'):format(string.lower(Config.Examiner.SpokenLanguage))})
                end
                while currentExam and driveErrors < Config.MaxDriveErrors do
                    local myPed = PlayerPedId()
                    local myVehicle = GetVehiclePedIsIn(myPed, false)
                    local currentHeight = GetEntityCoords(GetVehiclePedIsIn(PlayerPedId(), false))
                    SendNUIMessage({action = 'updateTaskProgress', value = math.floor(currentHeight.z - startHeight.z), id = 2})
                    if (currentHeight.z - startHeight.z) >= 200.0 then
                        setBlipToPoint(3)
                        SendNUIMessage({action = 'updateTaskProgress', value = '200', id = 2})
                        SendNUIMessage({action = 'updateTasks', done = 2, id = 2})
                        break
                    end
                    Citizen.Wait(1)
                end
            end
        },
        [3] = {...} -- Here are many more points
    },
    ['PLANE'] = {
        [1] = {
            action = function()
                if Config.Examiner.SpokenCommands and driveErrors < Config.MaxDriveErrors then
                    SendNUIMessage({action = 'audioTask', filename = ('helicopter.%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(-1612.94, -3098.39, 13.94),
            action = function()
                if Config.Examiner.SpokenCommands and driveErrors < Config.MaxDriveErrors then
                    SendNUIMessage({action = 'audioTask', filename = ('plane.%s_2.mp3'):format(string.lower(Config.Examiner.SpokenLanguage))})
                end
                local current = Config.PracticalTest['PLANE'][2]
                local nextpoint = Config.PracticalTest['PLANE'][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 myCoords = GetEntityCoords(PlayerPedId())
                    local distance = #(myCoords - current.coords)
                    if distance < 10.0 then
                        setBlipToPoint(3)
                        DeleteCheckpoint(currentCheckpoint)
                        PlaySoundFrontend(-1, 'CHECKPOINT_NORMAL', 'HUD_MINI_GAME_SOUNDSET', false)
                        SendNUIMessage({action = 'updateTasks', done = 2, id = 2})
                        break
                    end
                    Citizen.Wait(1)
                end
            end
        },
        [3] = {...} -- Here are many more points
    }
}

Last updated