1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-08-05 09:31:49 +02:00
parent 4c9a54ff7b
commit 5dd6e5a4e4
2 changed files with 20 additions and 5 deletions

View file

@ -98,7 +98,8 @@ function StartTracking(plate, vehicleData)
activeTrackings[plate] = {
vehicle = vehicleData.vehicle,
coords = vehicleData.coords,
lastUpdate = GetGameTimer()
lastUpdate = GetGameTimer(),
owner = vehicleData.owner or "Unbekannt"
}
-- Erstelle Blip
@ -114,6 +115,9 @@ function StartTracking(plate, vehicleData)
trackingBlips[plate] = blip
-- Zeige Besitzerinformation an
QBCore.Functions.Notify('Fahrzeug gehört: ' .. activeTrackings[plate].owner, 'info', 5000)
-- Starte Update Loop
CreateThread(function()
while activeTrackings[plate] do
@ -137,7 +141,7 @@ function ShowActiveTrackings()
local distance = #(GetEntityCoords(PlayerPedId()) - vector3(data.coords.x, data.coords.y, data.coords.z))
options[#options + 1] = {
title = 'Kennzeichen: ' .. plate,
description = 'Entfernung: ' .. math.floor(distance) .. 'm | Letztes Update: ' .. math.floor((GetGameTimer() - data.lastUpdate) / 1000) .. 's',
description = 'Besitzer: ' .. data.owner .. ' | Entfernung: ' .. math.floor(distance) .. 'm | Letztes Update: ' .. math.floor((GetGameTimer() - data.lastUpdate) / 1000) .. 's',
icon = 'fas fa-car',
onSelect = function()
SetNewWaypoint(data.coords.x, data.coords.y)

View file

@ -29,8 +29,17 @@ QBCore.Functions.CreateCallback('tracking:server:trackVehicle', function(source,
end
-- Suche Fahrzeug in der Datenbank
MySQL.Async.fetchAll('SELECT * FROM player_vehicles WHERE plate = ?', {plate}, function(result)
MySQL.Async.fetchAll('SELECT pv.*, p.charinfo FROM player_vehicles pv LEFT JOIN players p ON pv.citizenid = p.citizenid WHERE pv.plate = ?', {plate}, function(result)
if result[1] then
-- Extrahiere Besitzerinformationen
local ownerInfo = "Unbekannt"
if result[1].charinfo then
local charInfo = json.decode(result[1].charinfo)
if charInfo then
ownerInfo = charInfo.firstname .. " " .. charInfo.lastname
end
end
-- Suche das Fahrzeug in der Welt
local vehicles = GetAllVehicles()
local foundVehicle = nil
@ -51,12 +60,14 @@ QBCore.Functions.CreateCallback('tracking:server:trackVehicle', function(source,
activeTrackings[plate] = {
vehicle = foundVehicle,
coords = {x = vehicleCoords.x, y = vehicleCoords.y, z = vehicleCoords.z},
tracker = src
tracker = src,
owner = ownerInfo
}
cb(true, 'Fahrzeug gefunden!', {
vehicle = foundVehicle,
coords = {x = vehicleCoords.x, y = vehicleCoords.y, z = vehicleCoords.z}
coords = {x = vehicleCoords.x, y = vehicleCoords.y, z = vehicleCoords.z},
owner = ownerInfo
})
else
cb(false, 'Fahrzeug nicht in der Welt gefunden!')