ESX = nil QBCore = nil if (GetResourceState('es_extended') == 'started') then ESX = exports['es_extended']:getSharedObject() elseif (GetResourceState('qb-core') == 'started') then QBCore = exports['qb-core']:GetCoreObject() end Functions = {} Functions.Notify = function(message) if ESX then ESX.ShowNotification(message, 'info', 5000) elseif QBCore then QBCore.Functions.Notify(message, 'primary', 5000) end end Functions.CanVehicleHaveDartSystem = function(vehicle) local vehicleModel = GetEntityModel(vehicle) if not Config.allowedVehicles[vehicleModel] then return false end return true end Functions.CanVehicleShootDart = function(vehicle) return true end Functions.CanPlayerShootDart = function() -- For example: Add a job check if you wish return true end -- Called every frame when the vehicle is in 'sight' of the tracker system Functions.OnVehicleHit = function(targetVehicle, hitCoords) end Functions.CanOpenOverlay = function() local playerPed = PlayerPedId() local vehicle = GetVehiclePedIsIn(playerPed, false) if (vehicle == 0) then return false end -- Check if the ped is the driver local driverPed = GetPedInVehicleSeat(vehicle, -1) if (driverPed ~= playerPed) then return false end if IsPedDeadOrDying(playerPed, true) then return false end return true end Functions.HasJob = function() if not Config.allowedJobs then return true end local playerJob = 'unemployed' if ESX then playerJob = ESX.GetPlayerData()?.job?.name or 'unemployed' elseif QBCore then playerJob = QBCore.Functions.GetPlayerData()?.job?.name or 'unemployed' end return (Config.allowedJobs[playerJob] ~= nil) end Functions.ShouldDisplayBlips = function() return true end Functions.RemoveDartMinigame = function() local areaSize = 40 local speedMultiplier = 1.5 for i = 1, 5 do local success = lib.skillCheck({ areaSize = areaSize, speedMultiplier = speedMultiplier }, { 'E' }) if not success then return false end areaSize -= 2 speedMultiplier += 0.05 Wait(300) end return true end Functions.CanInteract = function(entity) local playerPed = PlayerPedId() if IsPedDeadOrDying(playerPed, true) then return false end if IsPedInAnyVehicle(playerPed, false) then return false end return true end Functions.CreateRemoveTarget = function(canInteract, onSelect) if (GetResourceState('ox_target') == 'started') then exports.ox_target:addGlobalVehicle({ { icon = 'fa-solid fa-xmark', label = Config.Locales['remove_target'], canInteract = function(entity) return canInteract(entity) end, onSelect = function(data) onSelect(data.entity) end, distance = Config.interactDistance, } }) return end if (GetResourceState('qb-target') == 'started') then exports['qb-target']:AddGlobalVehicle({ options = { { icon = 'fa-solid fa-xmark', label = Config.Locales['remove_target'], action = function(entity) onSelect(entity) end, canInteract = function(entity) return canInteract(entity) end, }, }, distance = Config.interactDistance, }) return end print('[ERROR] No target interaction defined. Please implement your own target interaction.') end Functions.InstallingTrackerSystem = function(entity) -- Called while installing the tracker system. -- For example: Add an animation or progress bar -- Return 'false' to cancel the installation return true end Functions.CreateInstallTarget = function(canInteract, onSelect) if (GetResourceState('ox_target') == 'started') then exports.ox_target:addGlobalVehicle({ { icon = 'fa-solid fa-location-crosshairs', label = Config.Locales['install_target'], distance = Config.interactDistance, items = Config.itemName, canInteract = function(entity) return canInteract(entity) end, onSelect = function(data) onSelect(data.entity) end, } }) return end if (GetResourceState('qb-target') == 'started') then exports['qb-target']:AddGlobalVehicle({ options = { { icon = 'fa-solid fa-location-crosshairs', label = Config.Locales['install_target'], item = Config.itemName, action = function(entity) onSelect(entity) end, canInteract = function(entity) return canInteract(entity) end, }, }, distance = Config.interactDistance, }) return end print('[ERROR] No target interaction defined. Please implement your own target interaction.') end