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"
|
-- Markiere Fahrzeug als "wird in Garage gestellt"
|
||||||
garagePending[plate] = true
|
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
|
-- Entferne aus Tracking
|
||||||
if trackedVehicles[plate] then
|
if trackedVehicles[plate] then
|
||||||
Debug("Fahrzeug wird in Garage gestellt, entferne aus Tracking: " .. plate)
|
Debug("Fahrzeug wird in Garage gestellt, entferne aus Tracking: " .. plate)
|
||||||
|
@ -561,26 +566,14 @@ RegisterNetEvent('jg-advancedgarages:client:vehicle-spawned', function(data)
|
||||||
end
|
end
|
||||||
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)
|
RegisterNetEvent('jg-advancedgarages:client:open-garage', function(garageId, vehicleType, spawnCoords)
|
||||||
Debug("Garage geöffnet: " .. garageId)
|
Debug("Garage geöffnet: " .. garageId)
|
||||||
|
|
||||||
local playerPos = GetEntityCoords(PlayerPedId())
|
-- No need to mark vehicles as potentially being stored here
|
||||||
|
-- Let the actual store-vehicle event handle this
|
||||||
-- 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
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Manuelle Lade-Funktion
|
-- Manuelle Lade-Funktion
|
||||||
|
@ -620,11 +613,12 @@ RegisterCommand('fixvehicle', function()
|
||||||
end
|
end
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
-- Cleanup beim Disconnect
|
|
||||||
AddEventHandler('onResourceStop', function(resourceName)
|
AddEventHandler('onResourceStop', function(resourceName)
|
||||||
if resourceName == GetCurrentResourceName() then
|
if resourceName == GetCurrentResourceName() then
|
||||||
|
Debug("Resource stopping, clearing all data")
|
||||||
trackedVehicles = {}
|
trackedVehicles = {}
|
||||||
lastKnownCoords = {}
|
lastKnownCoords = {}
|
||||||
garagePending = {}
|
garagePending = {}
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ Config.Servicing = {
|
||||||
--
|
--
|
||||||
engineOil = {
|
engineOil = {
|
||||||
enableDamage = true,
|
enableDamage = true,
|
||||||
lifespanInKm = 100,
|
lifespanInKm = 200,
|
||||||
itemName = "engine_oil",
|
itemName = "engine_oil",
|
||||||
itemQuantity = 1,
|
itemQuantity = 1,
|
||||||
restricted = "combustion",
|
restricted = "combustion",
|
||||||
|
@ -70,7 +70,7 @@ Config.Servicing = {
|
||||||
},
|
},
|
||||||
sparkPlugs = {
|
sparkPlugs = {
|
||||||
enableDamage = true,
|
enableDamage = true,
|
||||||
lifespanInKm = 150,
|
lifespanInKm = 200,
|
||||||
itemName = "spark_plug",
|
itemName = "spark_plug",
|
||||||
itemQuantity = 4,
|
itemQuantity = 4,
|
||||||
restricted = "combustion",
|
restricted = "combustion",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue