This is similar to the implementations that others have written, but this is the first public one, thanks.
However, I am skeptical whether this works in it’s current form. Reason being: you are sending entity handles/ids over the net, but these handles will be different across clients. Are you sure this works with multiple clients? Perhaps you need to use EntityToNet and NetToEntity to get the proper handles?
By itself this resource does nothing. This is more of a tool for developers to use by triggering certain events. If a person doesn’t know how to use this then they shouldn’t, it’s very simple.
This is similar to the implementations that others have written, but this is the first public one, thanks.
However, I am skeptical whether this works in it’s current form. Reason being: you are sending entity handles/ids over the net, but these handles will be different across clients. Are you sure this works with multiple clients? Perhaps you need to use EntityToNet and NetToEntity to get the proper handles?
Good point, I ought to further debug this and make proper changes if necessary.
Citizen.CreateThread(function()
while true do
while myworld ~= 0 do
SetPedDensityMultiplierThisFrame(0)
SetScenarioPedDensityMultiplierThisFrame(0, 0)
SetParkedVehicleDensityMultiplierThisFrame(0)
SetRandomVehicleDensityMultiplierThisFrame(0)
SetSomeVehicleDensityMultiplierThisFrame(0)
SetVehicleDensityMultiplierThisFrame(0)
ClearPlayerWantedLevel(PlayerId())
Citizen.Wait(0)
end
Citizen.Wait(1000)
end
end)
This was out of personal preference, I’m using this on a server I’m working on for a player race mini-game and I’d rather not have NPCs or NPC vehicles during the race.
By the way I pushed a little update that fixed entities not disappearing after switching between virtual worlds.