Decrease the amount of NPC, and Cars

How,

What scrip would decrease the number of NPC spawning? I once saw a script about this, cannot find it.

1 Like

Create a folder create a _resource.lua
create a client.lua and put this in the client.lua

DensityMultiplier = 0.45
Citizen.CreateThread(function()
	while true do
	    Citizen.Wait(0)
	    SetVehicleDensityMultiplierThisFrame(DensityMultiplier)
	    SetPedDensityMultiplierThisFrame(DensityMultiplier)
	    SetRandomVehicleDensityMultiplierThisFrame(DensityMultiplier)
	    SetParkedVehicleDensityMultiplierThisFrame(DensityMultiplier)
	    SetScenarioPedDensityMultiplierThisFrame(DensityMultiplier, DensityMultiplier)
	end
end)

Your welcome :slight_smile:

1 Like

@KrizFrost

Thanks!!!

Another question, could you help me with a simple script that makes you spawn in a specific vehicle on join? :slight_smile:

This is something your going to need to use when someone joined the server, now keep in mind you are going to need to specify some things but here it is

TaskWarpPedIntoVehicle(playerPed, vehicle, -1)

I took it from the esx_vehicleshop should really look at that script cause when you buy a vehicle it spawns you in the car at a certain “spawn” location specified in that script but that should help you.

@KrizFrost I ye figured that much, im atm at this stage, now sure how to keep going:

AddEventHandler(‘playerSpawned’, function()
local pos = GetEntityCoords(PlayerPedId())
local vehicle = CreateVehicle(“zentorno”, pos, 0.0, true, false)
TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)
end)

@KrizFrost any way to prevent NPC cars from spawning on top of each other as you are driving?

can you explain to me how to do the _resource.lua?

i really need this

client_scripts {

‘client.lua’

}

just put this on and it works ^^