Disabling OneSync population spawns entities
What happened?
Server-side event entityCreating is being triggered with the entity population type POPTYPE_RANDOM_PARKED when OneSync population is disabled.
The image below shows that the vehicle is actually spawned - in this case the blazer.
It usually happens around the same places - on the highway and hills near the military base, near the airport. But also can happen basically anywhere.
Expected result
No population (vehicles/peds)
Reproduction steps
- In txAdmin Settings > FXServer > Advanced > Startup Arguments set +set onesync_population false
- Have 100+ players online (this wasn't precisely measured)
- Listen to entityCreating event on server-side
- Server will trigger the event for entities with POPTYPE_RANDOM_PARKED
Importancy
Unknown
Area(s)
FXServer, OneSync
Specific version(s)
FiveM 19109, Server 17000
Additional information
No response
Could this be due to the client asking for the parked vehicle density native still being passed trough?
Could this be due to the client asking for the parked vehicle density native still being passed trough?
That could very well be a reason. Chances are that is not inherently disabled by the Lovely.cpp script call impl executed by the client when onesync_population is false.
As a potential workaround, one could perhaps try using SET_ALL_VEHICLE_GENERATORS_ACTIVE_IN_AREA. Which isn't fully documented, but the parameters seem to be as follows:
SetAllVehicleGeneratorsActiveInArea(
x1 --[[ number ]], -- Minimum World Coords on X
y1 --[[ number ]], -- Minimum World Coords on Y
z1 --[[ number ]], -- Minimum World Coords on Z
x2 --[[ number ]], -- Max World Coords on X
y2 --[[ number ]], -- Max World Coords on Y
z2 --[[ number ]], -- Max World Coords on Z
bActive --[[ boolean ]], -- Are car generators active or not? Set this to false to stop them from spawning
bNetworked --[[ boolean ]] -- Creates a CNetworkCarGenWorldStateData event and sends it over the network for synchronization
)
Having this issue too. It even happens on my localhost server with 1 player, almost everytime at the same places.
I’m experiencing the same issue, and it happens in several areas of the map. The main one is located at coordinates -201.4078, 255.3050, 92.1116, 269.3618 I had to use a loop to fix it, which defeats the purpose of setting onesync_population to false.
- Server hard-block
-- server.lua
local POP_RANDOM_PARKED = 7 -- also consider 6/5 if needed
AddEventHandler('entityCreating', function(entity)
local popType = GetEntityPopulationType(entity)
if popType == POP_RANDOM_PARKED then
CancelEvent()
return
end
-- extra safety: anything without a player owner
if not NetworkGetFirstEntityOwner(entity) or NetworkGetFirstEntityOwner(entity) == 0 then
local et = GetEntityType(entity) -- 1 ped, 2 vehicle, 3 object
if et == 1 or et == 2 then CancelEvent() end
end
end)
- Buckets/population switch
-- server.lua (run once, and whenever you create new buckets)
SetRoutingBucketPopulationEnabled(0, false) -- default bucket
-- repeat for any custom bucket IDs you use
- Client-side density and generators (must run every frame)
-- client.lua
CreateThread(function()
-- kill generators once
SetAllVehicleGeneratorsActive(false)
SetRandomBoats(false)
SetRandomTrains(false)
SetGarbageTrucks(false)
-- disable common vehicle scenarios
SetScenarioTypeEnabled('WORLD_VEHICLE_*', false)
while true do
-- per-frame densities
SetVehicleDensityMultiplierThisFrame(0.0)
SetParkedVehicleDensityMultiplierThisFrame(0.0)
SetRandomVehicleDensityMultiplierThisFrame(0.0)
SetPedDensityMultiplierThisFrame(0.0)
SetScenarioPedDensityMultiplierThisFrame(0.0, 0.0)
Wait(0)
end
end)
- cfg hints
- Keep
+set onesync_population falseand ensure OneSync is enabled. - Clear client/server cache after changes.
- With 100+ players, also ensure every routing bucket you use calls
SetRoutingBucketPopulationEnabled(bucket, false).
This combination stops POPTYPE_RANDOM_PARKED from replicating, even if the engine tries to spawn locals near airports/highways.