ed
This commit is contained in:
parent
4c9a54ff7b
commit
5dd6e5a4e4
2 changed files with 20 additions and 5 deletions
|
@ -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!')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue