1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-01 08:39:38 +02:00
parent 353887459e
commit 7fd4b36bb4
2 changed files with 130 additions and 12 deletions

View file

@ -144,16 +144,54 @@ RegisterNetEvent('qb_vehicle_tracker:client:scanTracker', function(slot)
playSound('TIMER_STOP', 'HUD_MINI_GAME_SOUNDSET')
local alert = lib.alertDialog({
header = locale('vt_alert_title'),
content = locale('vt_alert_description'),
centered = true,
cancel = true
})
if alert == 'confirm' then
-- Create scanner options menu
local options = {
{
title = locale('vt_remove_tracker') or "Remove Tracker",
description = locale('vt_remove_description') or "Remove the tracking device from this vehicle",
icon = 'trash',
onSelect = function()
TriggerEvent('qb_vehicle_tracker:client:removeTracker', slot)
end
},
{
title = locale('vt_locate_owner') or "Locate Tracker Owner",
description = locale('vt_locate_owner_description') or "Try to trace the signal back to the owner",
icon = 'satellite-dish',
onSelect = function()
TriggerEvent('qb_vehicle_tracker:client:locateTrackerOwner', GetVehicleNumberPlateText(vehicle))
end
}
}
-- Add police-only option to get phone number
local Player = QBCore.Functions.GetPlayerData()
local isPolice = false
for _, jobName in pairs(config.policeJobs) do
if Player.job.name == jobName then
isPolice = true
break
end
end
if isPolice then
table.insert(options, {
title = locale('vt_get_phone') or "Get Owner's Phone Number",
description = locale('vt_get_phone_description') or "Try to extract the owner's phone number",
icon = 'phone',
onSelect = function()
TriggerEvent('qb_vehicle_tracker:client:getTrackerOwnerPhone', GetVehicleNumberPlateText(vehicle))
end
})
end
lib.registerContext({
id = 'scanner_menu',
title = locale('vt_scanner_menu_header') or "Tracker Scanner",
options = options
})
lib.showContext('scanner_menu')
end, GetVehicleNumberPlateText(vehicle))
else
uiNotify(locale('vt_pb_cancelled'), 'error')
@ -212,7 +250,6 @@ RegisterNetEvent('qb_vehicle_tracker:client:removeTracker', function(slot)
uiNotify(locale('vt_pb_cancelled'), 'error')
end
end, vehPlate)
end)
RegisterNetEvent('qb_vehicle_tracker:client:locateTracker', function(serialNumber)
@ -242,6 +279,73 @@ RegisterNetEvent('qb_vehicle_tracker:client:locateTracker', function(serialNumbe
end, serialNumber)
end)
-- New events for advanced scanner features
RegisterNetEvent('qb_vehicle_tracker:client:locateTrackerOwner', function(vehiclePlate)
-- Perform a skill check
local success = lib.skillCheck({'easy', 'medium', 'medium'}, {'w', 'a', 's', 'd'})
if success then
lib.callback('qb_vehicle_tracker:getTrackerOwnerLocation', false, function(ownerCoords)
if not ownerCoords then
uiNotify(locale('vt_owner_not_found') or "Could not trace the signal back to the owner", 'error')
return
end
local blip = AddBlipForCoord(ownerCoords.x, ownerCoords.y, 0.0)
SetBlipSprite(blip, 280)
SetBlipColour(blip, 1)
SetBlipAlpha(blip, 250)
SetBlipDisplay(blip, 2)
SetBlipScale(blip, 1.0)
PulseBlip(blip)
SetBlipAsShortRange(blip, false)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName(locale('vt_tracker_owner') or "Tracker Owner")
EndTextCommandSetBlipName(blip)
SetNewWaypoint(ownerCoords.x, ownerCoords.y)
-- Store the blip with a unique key
local uniqueKey = "owner_" .. vehiclePlate
trackedVehicles[uniqueKey] = blip
playSound('Hack_Success', 'DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS')
uiNotify(locale('vt_owner_located') or "Successfully traced signal to the owner's location", 'success')
-- Remove the blip after some time
SetTimeout(60000, function()
if trackedVehicles[uniqueKey] then
RemoveBlip(trackedVehicles[uniqueKey])
trackedVehicles[uniqueKey] = nil
end
end)
end, vehiclePlate)
else
uiNotify(locale('vt_trace_failed') or "Failed to trace the signal", 'error')
playSound('Failure', 'DLC_HEIST_HACKING_SNAKE_SOUNDS')
end
end)
RegisterNetEvent('qb_vehicle_tracker:client:getTrackerOwnerPhone', function(vehiclePlate)
-- Perform a more difficult skill check for police
local success = lib.skillCheck({'medium', 'medium', 'hard'}, {'w', 'a', 's', 'd'})
if success then
lib.callback('qb_vehicle_tracker:getTrackerOwnerPhone', false, function(phoneNumber)
if not phoneNumber then
uiNotify(locale('vt_phone_not_found') or "Could not extract phone number from the tracker", 'error')
return
end
playSound('Hack_Success', 'DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS')
uiNotify((locale('vt_phone_found') or "Phone number extracted: ") .. phoneNumber, 'success')
end, vehiclePlate)
else
uiNotify(locale('vt_phone_extraction_failed') or "Failed to extract phone number", 'error')
playSound('Failure', 'DLC_HEIST_HACKING_SNAKE_SOUNDS')
end
end)
CreateThread(function()
while true do
Wait(3000)

View file

@ -27,5 +27,19 @@
"vt_locate_tracker": "Locate Vehicle",
"vt_locate_description": "Show the vehicle's location on the map",
"vt_rename_tracker": "Rename Tracker",
"vt_rename_description": "Change the name of this tracker"
"vt_rename_description": "Change the name of this tracker",
"vt_scanner_menu_header": "Tracker Scanner",
"vt_remove_tracker": "Remove Tracker",
"vt_remove_description": "Remove the tracking device from this vehicle",
"vt_locate_owner": "Locate Tracker Owner",
"vt_locate_owner_description": "Try to trace the signal back to the owner",
"vt_get_phone": "Get Owner's Phone Number",
"vt_get_phone_description": "Try to extract the owner's phone number",
"vt_owner_not_found": "Could not trace the signal back to the owner",
"vt_tracker_owner": "Tracker Owner",
"vt_owner_located": "Successfully traced signal to the owner's location",
"vt_trace_failed": "Failed to trace the signal",
"vt_phone_not_found": "Could not extract phone number from the tracker",
"vt_phone_found": "Phone number extracted: ",
"vt_phone_extraction_failed": "Failed to extract phone number"
}