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:
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. Ensure that it returns true or false, and most importantly, make sure your minigame export is async (otherwise, implement your own await mechanism)
function hackingMinigame()
local result = true
if GetResourceState('bl_ui') == "started" then
result = exports.bl_ui:PrintLock(3, {
grid = 4,
duration = 20000,
target = 4
})
end
return result
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:
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:
function SetFuel(vehicle)
-- Add your own fuel export/event here:
end
Notifications
The script uses the ox_lib notifications:
RegisterNetEvent("av_runs:notification", function(title, description, type)
lib.notify({
title = title,
description = description,
type = type
})
end)
Last updated