forked from Simnation/Main
Update client.lua
This commit is contained in:
parent
6a7c644ba1
commit
6a6c44143c
1 changed files with 56 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
-- Globale Variablen für Bewegungserkennung
|
||||||
|
local isPlayerMoving = true
|
||||||
|
local lastPos = vector3(0,0,0)
|
||||||
|
local positionCheckTimer = 0
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
-- Dispatch vollständig deaktivieren (Cops, Medic, Fire etc.)
|
-- Dispatch vollständig deaktivieren (Cops, Medic, Fire etc.)
|
||||||
for i = 1, 15 do
|
for i = 1, 15 do
|
||||||
|
@ -5,17 +10,41 @@ CreateThread(function()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Bewegungserkennung
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
while true do
|
while true do
|
||||||
-- Stark reduzierte Fahrzeug- und Fußgängerdichte
|
local playerPed = PlayerPedId()
|
||||||
SetPedDensityMultiplierThisFrame(0.5) -- Von 0.7 auf 0.5 reduziert
|
local currentPos = GetEntityCoords(playerPed)
|
||||||
SetScenarioPedDensityMultiplierThisFrame(0.5, 0.5) -- Von 0.7 auf 0.5 reduziert
|
|
||||||
|
|
||||||
-- Verkehrsdichte auf moderaten Wert setzen
|
-- Prüfen, ob der Spieler sich bewegt hat
|
||||||
SetVehicleDensityMultiplierThisFrame(0.1) -- Von 0.01 auf 0.3 erhöht
|
if #(currentPos - lastPos) < 1.0 then
|
||||||
SetRandomVehicleDensityMultiplierThisFrame(0.1) -- Von 0.01 auf 0.3 erhöht
|
positionCheckTimer = positionCheckTimer + 1
|
||||||
SetParkedVehicleDensityMultiplierThisFrame(0.1) -- Von 0.0 auf 0.2 erhöht
|
if positionCheckTimer > 5 then -- Nach 5 Sekunden ohne Bewegung
|
||||||
|
isPlayerMoving = false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
isPlayerMoving = true
|
||||||
|
positionCheckTimer = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
lastPos = currentPos
|
||||||
|
Wait(1000) -- Jede Sekunde prüfen
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
CreateThread(function()
|
||||||
|
while true do
|
||||||
|
-- Fußgängerdichte beibehalten
|
||||||
|
SetPedDensityMultiplierThisFrame(0.5)
|
||||||
|
SetScenarioPedDensityMultiplierThisFrame(0.5, 0.5)
|
||||||
|
|
||||||
|
-- Verkehrsdichte basierend auf Bewegung anpassen
|
||||||
|
local densityMultiplier = isPlayerMoving and 0.1 or 0.05
|
||||||
|
|
||||||
|
SetVehicleDensityMultiplierThisFrame(densityMultiplier)
|
||||||
|
SetRandomVehicleDensityMultiplierThisFrame(densityMultiplier)
|
||||||
|
SetParkedVehicleDensityMultiplierThisFrame(densityMultiplier)
|
||||||
|
SetParkedCarDensityPercentage(densityMultiplier)
|
||||||
|
|
||||||
-- Kein Wanted-Level / Polizei-Eingriffe
|
-- Kein Wanted-Level / Polizei-Eingriffe
|
||||||
SetPlayerWantedLevel(PlayerId(), 0, false)
|
SetPlayerWantedLevel(PlayerId(), 0, false)
|
||||||
|
@ -33,7 +62,6 @@ CreateThread(function()
|
||||||
local peds = GetGamePool("CPed")
|
local peds = GetGamePool("CPed")
|
||||||
for _, ped in ipairs(peds) do
|
for _, ped in ipairs(peds) do
|
||||||
if DoesEntityExist(ped) and not IsPedAPlayer(ped) then
|
if DoesEntityExist(ped) and not IsPedAPlayer(ped) then
|
||||||
local model = GetEntityModel(ped)
|
|
||||||
if IsPedInAnyVehicle(ped, false) then
|
if IsPedInAnyVehicle(ped, false) then
|
||||||
local veh = GetVehiclePedIsIn(ped, false)
|
local veh = GetVehiclePedIsIn(ped, false)
|
||||||
local vehModel = GetEntityModel(veh)
|
local vehModel = GetEntityModel(veh)
|
||||||
|
@ -48,31 +76,45 @@ CreateThread(function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Wait(100) -- Von 500ms auf 100ms reduziert für häufigere Updates
|
Wait(100)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Thread für Verkehrsmanagement
|
-- Thread für Verkehrsmanagement
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
while true do
|
while true do
|
||||||
-- Zusätzliche Verkehrsbereinigung in größeren Intervallen
|
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
local coords = GetEntityCoords(playerPed)
|
local coords = GetEntityCoords(playerPed)
|
||||||
|
|
||||||
-- Entferne nur Fahrzeuge, die sehr weit entfernt sind
|
-- Wenn Spieler steht, aggressiver Fahrzeuge in der Nähe entfernen
|
||||||
|
if not isPlayerMoving then
|
||||||
|
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)
|
||||||
|
|
||||||
|
-- Wenn Spieler steht, Fahrzeuge in mittlerer Entfernung entfernen
|
||||||
|
if distance > 100.0 and distance < 200.0 then
|
||||||
|
DeleteEntity(vehicle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Normale Entfernung für weit entfernte Fahrzeuge
|
||||||
local vehicles = GetGamePool("CVehicle")
|
local vehicles = GetGamePool("CVehicle")
|
||||||
for _, vehicle in ipairs(vehicles) do
|
for _, vehicle in ipairs(vehicles) do
|
||||||
if DoesEntityExist(vehicle) and not IsPedAPlayer(GetPedInVehicleSeat(vehicle, -1)) then
|
if DoesEntityExist(vehicle) and not IsPedAPlayer(GetPedInVehicleSeat(vehicle, -1)) then
|
||||||
local vehCoords = GetEntityCoords(vehicle)
|
local vehCoords = GetEntityCoords(vehicle)
|
||||||
local distance = #(coords - vehCoords)
|
local distance = #(coords - vehCoords)
|
||||||
|
|
||||||
-- Fahrzeuge erst bei größerer Entfernung löschen
|
if distance > 250.0 then
|
||||||
if distance > 300.0 then
|
|
||||||
DeleteEntity(vehicle)
|
DeleteEntity(vehicle)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Wait(10000) -- Von 5000 auf 10000 erhöht (alle 10 Sekunden prüfen)
|
Wait(8000)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue