Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUGGESTION] Allow selection of specific NPCs to disable #1

Open
SirHaxe opened this issue Apr 21, 2021 · 1 comment
Open

[SUGGESTION] Allow selection of specific NPCs to disable #1

SirHaxe opened this issue Apr 21, 2021 · 1 comment

Comments

@SirHaxe
Copy link

SirHaxe commented Apr 21, 2021

For example: Let normal people drive around, but disable cops, firetrucks and ambulance!

@Aniol0012
Copy link

This can be easly implemented with something like this:

config.lua:

-- Density values from 0.0 to 1.0.
DENSITY_MULTIPLIER = 0.1 -- 10% of the normal density
EMERGENCY_DENSITY_MULTIPLIER = 0.0 -- 0.0 to prevent emergency vehicles and peds from spawning


SPAWN_COPS = false
SPAWN_AMBULANCE = false

client.lua:

local config = {
   DENSITY_MULTIPLIER = DENSITY_MULTIPLIER,
   EMERGENCY_DENSITY_MULTIPLIER = EMERGENCY_DENSITY_MULTIPLIER,
   SPAWN_COPS = SPAWN_COPS,
   SPAWN_AMBULANCE = SPAWN_AMBULANCE
}

Citizen.CreateThread(function()
   while true do
       Citizen.Wait(0)
       
       -- General density settings
       SetVehicleDensityMultiplierThisFrame(config.DENSITY_MULTIPLIER)
       SetPedDensityMultiplierThisFrame(config.DENSITY_MULTIPLIER)
       SetRandomVehicleDensityMultiplierThisFrame(config.DENSITY_MULTIPLIER)
       SetParkedVehicleDensityMultiplierThisFrame(config.DENSITY_MULTIPLIER)
       SetScenarioPedDensityMultiplierThisFrame(config.DENSITY_MULTIPLIER, config.DENSITY_MULTIPLIER)

       -- Police settings
       SetDispatchCopsForPlayer(PlayerId(), config.SPAWN_COPS)
       SetCreateRandomCopsNotOnScenarios(config.SPAWN_COPS)
       SetCreateRandomCopsOnScenarios(config.SPAWN_COPS)
       SetCreateRandomCops(config.SPAWN_COPS)

       -- Emergency services settings
       if not config.SPAWN_AMBULANCE then
           -- Disable dispatch services for emergency vehicles
           for i = 1, 15 do
               EnableDispatchService(i, false)
           end
       end
   end
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants