forked from Simnation/Main
ed
This commit is contained in:
parent
ce8523babd
commit
4f19e732f8
2 changed files with 15 additions and 21 deletions
|
@ -506,7 +506,12 @@ RegisterNetEvent('jg-advancedgarages:client:store-vehicle', function(garageId, g
|
|||
|
||||
-- Markiere Fahrzeug als "wird in Garage gestellt"
|
||||
garagePending[plate] = true
|
||||
|
||||
SetTimeout(10000, function()
|
||||
if garagePending[plate] then
|
||||
Debug("Garage storage timeout for vehicle: " .. plate)
|
||||
garagePending[plate] = nil
|
||||
end
|
||||
end)
|
||||
-- Entferne aus Tracking
|
||||
if trackedVehicles[plate] then
|
||||
Debug("Fahrzeug wird in Garage gestellt, entferne aus Tracking: " .. plate)
|
||||
|
@ -561,26 +566,14 @@ RegisterNetEvent('jg-advancedgarages:client:vehicle-spawned', function(data)
|
|||
end
|
||||
end)
|
||||
|
||||
-- Öffnen der Garage - entferne Tracking für Fahrzeuge in der Nähe
|
||||
-- Öffnen der Garage
|
||||
|
||||
|
||||
RegisterNetEvent('jg-advancedgarages:client:open-garage', function(garageId, vehicleType, spawnCoords)
|
||||
Debug("Garage geöffnet: " .. garageId)
|
||||
|
||||
local playerPos = GetEntityCoords(PlayerPedId())
|
||||
|
||||
-- Prüfe alle getrackten Fahrzeuge
|
||||
for plate, vehicle in pairs(trackedVehicles) do
|
||||
if DoesEntityExist(vehicle) then
|
||||
local vehiclePos = GetEntityCoords(vehicle)
|
||||
local distance = #(playerPos - vehiclePos)
|
||||
|
||||
-- Wenn Fahrzeug in der Nähe ist (50m), markiere als "wird möglicherweise in Garage gestellt"
|
||||
if distance < 50.0 then
|
||||
Debug("Fahrzeug in Garagennähe: " .. plate)
|
||||
-- Nicht komplett entfernen, nur markieren
|
||||
-- Das Event jg-advancedgarages:client:store-vehicle wird ausgelöst wenn es eingelagert wird
|
||||
end
|
||||
end
|
||||
end
|
||||
-- No need to mark vehicles as potentially being stored here
|
||||
-- Let the actual store-vehicle event handle this
|
||||
end)
|
||||
|
||||
-- Manuelle Lade-Funktion
|
||||
|
@ -620,11 +613,12 @@ RegisterCommand('fixvehicle', function()
|
|||
end
|
||||
end, false)
|
||||
|
||||
-- Cleanup beim Disconnect
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if resourceName == GetCurrentResourceName() then
|
||||
Debug("Resource stopping, clearing all data")
|
||||
trackedVehicles = {}
|
||||
lastKnownCoords = {}
|
||||
garagePending = {}
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue