📃Config

Config = {}

-- General Settings --
Config.Framework = "qb" -- "qb" or "esx"
Config.Language = "en" -- "pt" or "en"
Config.Core = "qb-core" -- Your qb-core folder name ( If you use qbox or esx dont change this )
Config.Target = "qb" -- "qb" or "ox" or "3dtext"
Config.Inventory = "oldqb" -- "oldqb" or "newqb" or "ox" or "qs" or "tgiann" or "codem" ( open code on s_utils.lua )
Config.EmoteMenu = "rp" -- "rp" or "dp" or "scully" or "aty_emote" or "cylex_animmenuv2" or "r_animations" ( open code on config_functions.lua )
Config.Notify = "ox" -- "standalone", "qb" or "okok" or "ox" or "codem" ( open code on config_functions.lua )
Config.Society = "qb-management" -- "qb-management" or "qb-banking" or "okokBanking" or "renewed-banking" ( open code on s_utils.lua )
Config.AutoDatabase = true -- If you set this to true, all the database tables to DB will be done automatically
Config.Debug = true -- If true, debug messages will be printed in the console and have some custom commands
Config.InspectionDuration = 30 -- 30 Days ( Real Days ) 
Config.mInsurance = true -- Use m-Insurance? (This is gona check if the vehile is marked stolen by police) https://marcinhu.tebex.io/package/5178123
Config.JG_vehiclemileage = true -- Do you use jg-vehiclemileage? https://github.com/jgscripts/jg-vehiclemileage 
-- General Settings --


Config.Inspections = {
    [1] = {
        name = "Mechanic Inspection", -- Name of the inspection
        needJob = true, -- If true, the player must have a specific job to access this inspection
        job = "mechanic", -- The job required to access this inspection
        pedLocation = vector4(-200.54, -1309.61, 31.29, 2.28), -- Location of the ped
        pedModel = "s_m_m_autoshop_02", -- Model of the ped
        inspectionPrice = 100, -- Price for the inspection
        useSociety = { 
            enable = true, -- If true, the inspection will use the society money
            society = "mechanic", -- The society name to use for the inspection
            amount = 100 -- Amount to deduct from the society money
        },
    },
    [2] = {
        name = "Bennys Inspection", -- Name of the inspection
        needJob = false, -- If true, the player must have a specific job to access this inspection
        job = "bennys", -- The job required to access this inspection
        pedLocation = vector4(456.12, -1017.45, 28.27, 90.0), -- Location of the ped
        pedModel = "s_m_y_construct_01", -- Model of the ped
        inspectionPrice = 200, -- Price for the inspection
        useSociety = { 
            enable = true, -- If true, the inspection will use the society money
            society = "mechanic", -- The society name to use for the inspection
            amount = 200 -- Amount to deduct from the society money
        },
    },
    -- You can add more inspections here
}


Config.InspectionParts = {
    [1] = {
        title = "Drive your vehicle for at least 1 minute to check the engine and transmission.",
        icon = "car",
        successMessage = "Engine and transmission test passed.",
        failMessage = "Test cancelled or failed.",
        customCheck = function(vehicle)
            local duration = 10 -- Time in seconds player need to drive
            local playerPed = PlayerPedId()
            local startTime = GetGameTimer()
            local endTime = startTime + (duration * 1000)

            ShowInspectionUI("Drive your vehicle for at least " .. duration .. " seconds to check the engine and transmission.", "Time left: " .. duration .. "s")

            while GetGameTimer() < endTime do
                if not IsPedInVehicle(playerPed, vehicle, false) then
                    HideInspectionUI()
                    Notify('You exited the vehicle, inspection cancelled.', 'error', 5000)
                    return false
                end

                local now = GetGameTimer()
                local timeLeft = math.ceil((endTime - now) / 1000)
                UpdateInspectionUI(nil, "Time left: " .. timeLeft .. "s")
                Wait(500)
            end

            HideInspectionUI()
            return true
        end
    },
    [2] = {
        title = "Turn on and off your headlights.",
        icon = "lightbulb",
        successMessage = "Lights test completed successfully.",
        failMessage = "Lights test failed or not performed.",
        customCheck = function(vehicle)
            ShowInspectionUI("[H] - Please turn off/on your headlights", "")

            local pressCount = 0
            local startTime = GetGameTimer()
            local timeout = 15000
            local hPressed = false

            while true do
                if GetGameTimer() - startTime > timeout then
                    HideInspectionUI()
                    return false
                end

                -- Detetar quando a tecla H for pressionada (74)
                if IsControlPressed(0, 74) then
                    if not hPressed then
                        hPressed = true
                        pressCount = pressCount + 1
                        UpdateInspectionUI(nil, string.format("Pressed H %d/2 times", pressCount))

                        if pressCount >= 2 then
                            HideInspectionUI()
                            return true
                        end
                    end
                else
                    hPressed = false
                end

                Wait(10)
            end
        end
    },
    [3] = {
        title = "Brake multiple times to test the brake system.",
        icon = "hand-paper",
        successMessage = "Brake test completed successfully.",
        failMessage = "Brake test failed or not performed.",
        customCheck = function(vehicle)
            local brakesPressed = 0
            local lastPress = false
            local startTime = GetGameTimer()
            local timeout = 15000 -- 15 seconds to complete

            ShowInspectionUI("Press the brake at least 3 times", "0 / 3")

            while true do
                if GetGameTimer() - startTime > timeout then
                    HideInspectionUI()
                    return false
                end

                local pressed = IsControlPressed(0, 72)
                if pressed and not lastPress then
                    brakesPressed = brakesPressed + 1
                    UpdateInspectionUI(nil, brakesPressed .. " / 3")
                end
                lastPress = pressed

                if brakesPressed >= 3 then
                    HideInspectionUI()
                    return true
                end
                Wait(100)
            end
        end
    },
    [4] = {
        title = "Sound the horn at least 3 times.",
        icon = "bullhorn",
        successMessage = "Horn test passed.",
        failMessage = "You didn't use the horn in time.",
        customCheck = function(vehicle)
            local hornPressed = 0
            local lastState = false
            local startTime = GetGameTimer()
            local timeout = 15000 -- 15 seconds to complete

            ShowInspectionUI("Honk the horn at least 3 times", "0 / 3")

            while true do
                if GetGameTimer() - startTime > timeout then
                    HideInspectionUI()
                    return false
                end

                local pressed = IsControlPressed(0, 86)
                if pressed and not lastState then
                    hornPressed = hornPressed + 1
                    UpdateInspectionUI(nil, hornPressed .. " / 3")
                end
                lastState = pressed

                if hornPressed >= 3 then
                    HideInspectionUI()
                    return true
                end
                Wait(100)
            end
        end
    },
    [5] = {
        title = "Turn the steering wheel fully to both sides.",
        icon = "arrows-alt-h",
        successMessage = "Steering test passed successfully.",
        failMessage = "You didn't steer fully to both sides.",
        customCheck = function(vehicle)
            local left = false
            local right = false
            local startTime = GetGameTimer()
            local timeout = 15000

            ShowInspectionUI("Turn your steering wheel fully left and then fully right.", "Left ✘ / Right ✘")

            while GetGameTimer() - startTime < timeout do
                local angle = GetVehicleSteeringAngle(vehicle)

                if angle < 0.25 then right = true end
                if angle > -0.25 then left = true end

                UpdateInspectionUI(nil, string.format("Left %s / Right %s", left and "✔" or "✘", right and "✔" or "✘"))

                if left and right then
                    HideInspectionUI()
                    return true
                end
                Wait(100)
            end

            HideInspectionUI()
            return false
        end
    },
    [6] = {
        title = "Accelerate to 100 km/h and then brake to a complete stop.",
        icon = "tachometer-alt",
        successMessage = "Acceleration and braking test passed.",
        failMessage = "You didn't reach the required speed or stop correctly.",
        customCheck = function(vehicle)
            local speedLimitReached = false
            local speedStopReached = false
            local startTime = GetGameTimer()
            local timeout = 20000 -- 20 segundos

            ShowInspectionUI("Accelerate to 100 km/h and then brake completely", "0 / 2")

            while GetGameTimer() - startTime < timeout do
                local speedKmh = GetEntitySpeed(vehicle) * 3.6

                if not speedLimitReached and speedKmh >= 100.0 then
                    speedLimitReached = true
                    UpdateInspectionUI(nil, "1 / 2")
                end

                if speedLimitReached and not speedStopReached and speedKmh <= 1.0 then
                    speedStopReached = true
                    UpdateInspectionUI(nil, "2 / 2")
                    HideInspectionUI()
                    return true
                end
                Wait(100)
            end

            HideInspectionUI()
            return false
        end
    },
}


-- Commands for the script
Config.Commands = {
    myInspections = { -- This command is allowed for all players can see their own inspections
        name = 'myinspections',
        help = 'Check your inspections',
        restricted = false
    },
    createInspection = { -- This command is for admins can create a inspection for a specific vehicle
        name = 'createinspection',
        help = 'Open inspection menu',
        restricted = 'group.admin'
    },
    checkInspection = { -- This command is for police can check inspection on closest vehicle
        name = 'checkinspection',
        help = 'Check a closest vehicle inspection',
        jobs = {'police', 'lspd'}
    }
}

Last updated