diff --git a/resources/[standalone]/controlled_npcs/client.lua b/resources/[standalone]/controlled_npcs/client.lua index 61f0ab163..92c7ef33b 100644 --- a/resources/[standalone]/controlled_npcs/client.lua +++ b/resources/[standalone]/controlled_npcs/client.lua @@ -7,13 +7,19 @@ end) CreateThread(function() while true do - -- Nur normale Zivilisten und Autos erhalten - SetPedDensityMultiplierThisFrame(0.7) - SetScenarioPedDensityMultiplierThisFrame(0.7, 0.7) - SetVehicleDensityMultiplierThisFrame(0.1) - SetRandomVehicleDensityMultiplierThisFrame(0.1) - SetParkedVehicleDensityMultiplierThisFrame(0.0) - + -- Stark reduzierte Fahrzeug- und Fußgängerdichte + SetPedDensityMultiplierThisFrame(0.5) -- Von 0.7 auf 0.5 reduziert + SetScenarioPedDensityMultiplierThisFrame(0.5, 0.5) -- Von 0.7 auf 0.5 reduziert + + -- Verkehrsdichte auf Minimum setzen + SetVehicleDensityMultiplierThisFrame(0.01) -- Von 0.1 auf 0.01 reduziert + SetRandomVehicleDensityMultiplierThisFrame(0.01) -- Von 0.1 auf 0.01 reduziert + SetParkedVehicleDensityMultiplierThisFrame(0.0) -- Bleibt bei 0.0 + + -- Zusätzliche Verkehrskontrollen + SetSomeCarDensityMultiplierThisFrame(0.01) -- Neu hinzugefügt + SetParkedCarDensityPercentage(0.0) -- Neu hinzugefügt + -- Kein Wanted-Level / Polizei-Eingriffe SetPlayerWantedLevel(PlayerId(), 0, false) ClearPlayerWantedLevel(PlayerId()) @@ -25,6 +31,11 @@ CreateThread(function() local coords = GetEntityCoords(playerPed) ClearAreaOfCops(coords.x, coords.y, coords.z, 1000.0) + + -- Periodisch Fahrzeuge in der Umgebung entfernen (alle ~10 Sekunden) + if math.random(1, 100) <= 10 then + ClearAreaOfVehicles(coords.x, coords.y, coords.z, 200.0, false, false, false, false, false) + end local peds = GetGamePool("CPed") for _, ped in ipairs(peds) do @@ -33,16 +44,6 @@ CreateThread(function() if IsPedInAnyVehicle(ped, false) then local veh = GetVehiclePedIsIn(ped, false) local vehModel = GetEntityModel(veh) - --[[ if vehModel == GetHashKey("ambulance") or - vehModel == GetHashKey("police") or - vehModel == GetHashKey("police2") or - vehModel == GetHashKey("sheriff") or - vehModel == GetHashKey("sheriff2") or - vehModel == GetHashKey("firetruk") or - vehModel == GetHashKey("towtruck") then - DeleteEntity(veh) - DeleteEntity(ped) - end ]] for k, v in pairs(Config.vehModels) do if vehModel == GetHashKey(v) then @@ -54,6 +55,31 @@ CreateThread(function() end end - Wait(500) + Wait(100) -- Von 500ms auf 100ms reduziert für häufigere Updates + end +end) + +-- Neuer Thread speziell für Verkehrsmanagement +CreateThread(function() + while true do + -- Zusätzliche Verkehrsbereinigung in größeren Intervallen + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + + -- Entferne Fahrzeuge, die zu weit entfernt sind + local vehicles = GetGamePool("CVehicle") + for _, vehicle in ipairs(vehicles) do + if DoesEntityExist(vehicle) and not IsPedAPlayer(GetPedInVehicleSeat(vehicle, -1)) then + local vehCoords = GetEntityCoords(vehicle) + local distance = #(coords - vehCoords) + + -- Fahrzeuge löschen, die weiter als 150 Einheiten entfernt sind + if distance > 150.0 then + DeleteEntity(vehicle) + end + end + end + + Wait(5000) -- Alle 5 Sekunden prüfen end end)