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()
|
||||
-- Dispatch vollständig deaktivieren (Cops, Medic, Fire etc.)
|
||||
for i = 1, 15 do
|
||||
|
@ -5,17 +10,41 @@ CreateThread(function()
|
|||
end
|
||||
end)
|
||||
|
||||
-- Bewegungserkennung
|
||||
CreateThread(function()
|
||||
while true do
|
||||
-- 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
|
||||
local playerPed = PlayerPedId()
|
||||
local currentPos = GetEntityCoords(playerPed)
|
||||
|
||||
-- Verkehrsdichte auf moderaten Wert setzen
|
||||
SetVehicleDensityMultiplierThisFrame(0.1) -- Von 0.01 auf 0.3 erhöht
|
||||
SetRandomVehicleDensityMultiplierThisFrame(0.1) -- Von 0.01 auf 0.3 erhöht
|
||||
SetParkedVehicleDensityMultiplierThisFrame(0.1) -- Von 0.0 auf 0.2 erhöht
|
||||
-- Prüfen, ob der Spieler sich bewegt hat
|
||||
if #(currentPos - lastPos) < 1.0 then
|
||||
positionCheckTimer = positionCheckTimer + 1
|
||||
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
|
||||
SetPlayerWantedLevel(PlayerId(), 0, false)
|
||||
|
@ -33,7 +62,6 @@ CreateThread(function()
|
|||
local peds = GetGamePool("CPed")
|
||||
for _, ped in ipairs(peds) do
|
||||
if DoesEntityExist(ped) and not IsPedAPlayer(ped) then
|
||||
local model = GetEntityModel(ped)
|
||||
if IsPedInAnyVehicle(ped, false) then
|
||||
local veh = GetVehiclePedIsIn(ped, false)
|
||||
local vehModel = GetEntityModel(veh)
|
||||
|
@ -48,31 +76,45 @@ CreateThread(function()
|
|||
end
|
||||
end
|
||||
|
||||
Wait(100) -- Von 500ms auf 100ms reduziert für häufigere Updates
|
||||
Wait(100)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Thread für Verkehrsmanagement
|
||||
CreateThread(function()
|
||||
while true do
|
||||
-- Zusätzliche Verkehrsbereinigung in größeren Intervallen
|
||||
local playerPed = PlayerPedId()
|
||||
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")
|
||||
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 erst bei größerer Entfernung löschen
|
||||
if distance > 300.0 then
|
||||
if distance > 250.0 then
|
||||
DeleteEntity(vehicle)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Wait(10000) -- Von 5000 auf 10000 erhöht (alle 10 Sekunden prüfen)
|
||||
Wait(8000)
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue