Customization

  • There's some functions and events that you might need to customize the script and adapt it to your own server: dispatch, key system, notifications style, etc.

Dispatch Event

  • This event is triggered when the job vehicle enters a mission zone, the event receives the vehicle entity so you can use it with your own dispatch system:

client/framework/cops.lua
RegisterNetEvent("av_runs:sendDispatch", function(vehicle)
    -- Your dispatch event/export goes here:
    -- This example is only for ps-dispatch (make sure to read the docs first)
    if Config.Debug then
        print("Dispatch triggered")
    end
    if GetResourceState("ps-dispatch") ~= "missing" then
        exports['ps-dispatch']:VehicleShooting(vehicle)
    end
end)

Hacking Minigame

  • This minigame is activated when the driver uses the hacking device while inside the job vehicle:

client/framework/minigame.lua
function hackingMinigame()
    local finished = false
    local res = false
    exports['ps-ui']:Scrambler(function(result)
        finished = true
        res = result
    end, "numeric", 15, 0)
    while not finished do Wait(100) end
    return res
end

Vehicle Keys

  • Once the vehicle is hacked and the driver has full control of it, this function is triggered so you can add your own vehicle keys export/event and give the vehicle keys to the player:

client/framework/functions.lua
function GiveKeys(vehicle) -- Just in case u need the vehicle object
    local plates = GetVehicleNumberPlateText(vehicle)
    -- Give vehicle keys export/event:
end

Set Fuel

  • The job vehicle is spawned with some random fuel set by the server, use your own export to add more:

client/framework/functions.lua
function SetFuel(vehicle)
    -- Add your own fuel export/event here:
    
end

Notifications

  • The script uses the ox_lib notifications:

client/framework/notifications.lua
RegisterNetEvent("av_runs:notification", function(title, description, type)
    lib.notify({
        title = title,
        description = description,
        type = type
    })
end)

Last updated