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 ^^

I folowed all the steps and it din’t work, he do not start the script but I have the resource.lua and the client.lua.

Can some one help me?

Use fxmanifest instead of __resource:

fxmanifest.lua

fx_version 'cerulean'
games {'gta5' }

client_scripts {
    'client.lua'
}

client.lua

Thank you it works!. and I have another question I don’t know if you can help me with this but I’m looking for a script that if you have a server joint for the first time that you have to make a test and if you fail that you can then get a blacklist role in the discord, and of course that you get a whitelist role in the discord if you do pass the test.