48 lines
1.7 KiB
Lua
48 lines
1.7 KiB
Lua
-- Remove all ambient NPCs, scenarios, and traffic
|
|
Citizen.CreateThread(function()
|
|
while true do
|
|
SetPedDensityMultiplierThisFrame(0.0)
|
|
SetScenarioPedDensityMultiplierThisFrame(0.0, 0.0)
|
|
SetVehicleDensityMultiplierThisFrame(0.0)
|
|
SetRandomVehicleDensityMultiplierThisFrame(0.0)
|
|
SetParkedVehicleDensityMultiplierThisFrame(0.0)
|
|
SetGarbageTrucks(false)
|
|
SetRandomBoats(false)
|
|
SetRandomTrains(false)
|
|
Citizen.Wait(0)
|
|
end
|
|
end)
|
|
|
|
-- Permanently remove specific world entities
|
|
local entitiesToRemove = {
|
|
{ hash = 1152297372, coords = vector3(-346.68, -1525.71, 26.71), range = 5.0 }, -- Brute trailer on Alta St
|
|
{ hash = -2129526670, coords = vector3(-339.91, -1538.04, 26.71), range = 5.0 }, -- Dumpster on Alta St
|
|
}
|
|
|
|
Citizen.CreateThread(function()
|
|
for _, ent in ipairs(entitiesToRemove) do
|
|
RequestModel(ent.hash)
|
|
while not HasModelLoaded(ent.hash) do
|
|
Citizen.Wait(10)
|
|
end
|
|
local obj = GetClosestObjectOfType(ent.coords.x, ent.coords.y, ent.coords.z, ent.range, ent.hash, false, false, false)
|
|
if obj and obj ~= 0 then
|
|
SetEntityAsMissionEntity(obj, true, true)
|
|
DeleteEntity(obj)
|
|
end
|
|
SetModelAsNoLongerNeeded(ent.hash)
|
|
end
|
|
|
|
-- Keep checking in case it respawns
|
|
while true do
|
|
Citizen.Wait(10000)
|
|
for _, ent in ipairs(entitiesToRemove) do
|
|
local obj = GetClosestObjectOfType(ent.coords.x, ent.coords.y, ent.coords.z, ent.range, ent.hash, false, false, false)
|
|
if obj and obj ~= 0 then
|
|
SetEntityAsMissionEntity(obj, true, true)
|
|
DeleteEntity(obj)
|
|
end
|
|
end
|
|
end
|
|
end)
|