forked from Simnation/Main
ed
This commit is contained in:
parent
4c9a54ff7b
commit
5dd6e5a4e4
2 changed files with 20 additions and 5 deletions
|
@ -98,7 +98,8 @@ function StartTracking(plate, vehicleData)
|
||||||
activeTrackings[plate] = {
|
activeTrackings[plate] = {
|
||||||
vehicle = vehicleData.vehicle,
|
vehicle = vehicleData.vehicle,
|
||||||
coords = vehicleData.coords,
|
coords = vehicleData.coords,
|
||||||
lastUpdate = GetGameTimer()
|
lastUpdate = GetGameTimer(),
|
||||||
|
owner = vehicleData.owner or "Unbekannt"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Erstelle Blip
|
-- Erstelle Blip
|
||||||
|
@ -114,6 +115,9 @@ function StartTracking(plate, vehicleData)
|
||||||
|
|
||||||
trackingBlips[plate] = blip
|
trackingBlips[plate] = blip
|
||||||
|
|
||||||
|
-- Zeige Besitzerinformation an
|
||||||
|
QBCore.Functions.Notify('Fahrzeug gehört: ' .. activeTrackings[plate].owner, 'info', 5000)
|
||||||
|
|
||||||
-- Starte Update Loop
|
-- Starte Update Loop
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
while activeTrackings[plate] do
|
while activeTrackings[plate] do
|
||||||
|
@ -137,7 +141,7 @@ function ShowActiveTrackings()
|
||||||
local distance = #(GetEntityCoords(PlayerPedId()) - vector3(data.coords.x, data.coords.y, data.coords.z))
|
local distance = #(GetEntityCoords(PlayerPedId()) - vector3(data.coords.x, data.coords.y, data.coords.z))
|
||||||
options[#options + 1] = {
|
options[#options + 1] = {
|
||||||
title = 'Kennzeichen: ' .. plate,
|
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',
|
icon = 'fas fa-car',
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
SetNewWaypoint(data.coords.x, data.coords.y)
|
SetNewWaypoint(data.coords.x, data.coords.y)
|
||||||
|
|
|
@ -29,8 +29,17 @@ QBCore.Functions.CreateCallback('tracking:server:trackVehicle', function(source,
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Suche Fahrzeug in der Datenbank
|
-- 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
|
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
|
-- Suche das Fahrzeug in der Welt
|
||||||
local vehicles = GetAllVehicles()
|
local vehicles = GetAllVehicles()
|
||||||
local foundVehicle = nil
|
local foundVehicle = nil
|
||||||
|
@ -51,12 +60,14 @@ QBCore.Functions.CreateCallback('tracking:server:trackVehicle', function(source,
|
||||||
activeTrackings[plate] = {
|
activeTrackings[plate] = {
|
||||||
vehicle = foundVehicle,
|
vehicle = foundVehicle,
|
||||||
coords = {x = vehicleCoords.x, y = vehicleCoords.y, z = vehicleCoords.z},
|
coords = {x = vehicleCoords.x, y = vehicleCoords.y, z = vehicleCoords.z},
|
||||||
tracker = src
|
tracker = src,
|
||||||
|
owner = ownerInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(true, 'Fahrzeug gefunden!', {
|
cb(true, 'Fahrzeug gefunden!', {
|
||||||
vehicle = foundVehicle,
|
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
|
else
|
||||||
cb(false, 'Fahrzeug nicht in der Welt gefunden!')
|
cb(false, 'Fahrzeug nicht in der Welt gefunden!')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue