No peds on the server

good evening I come to you because I’m at my wit’s end

First of all I would like to clarify a certain point before anyone comes to ask me this question.

I reinstalled 3 times fivem
I reinstalled my server 10 times
I tested on another machine
Is I am strictly No F8 or logs , or mysql , no error

Here’s my problem, I’m strictly no peds on the server, no peds on the sidewalk, on the road or even on the parking lot, ghost town, I’m not any script that manages the density of Pnj, I tried to put one to see if it will put my nothing,

I’ve been looking for 3 days already.

Do you know what your scripts do? It really looks like a script that just removes peds.
This would normally be called every frame to set that:

I tested on a blank base with only the server-data base and no peds

this function can be placed anywhere it will remove all the peds from the map in a loop? For example in a loading script or can it be placed anywhere ?

That’s a client-only native you can run, and it needs to be run in a constant every-frame loop, something like this:

Citizen.CreateThread(function)
Citizen.Wait(0)
SetPedDensityMultiplierThisFrame(0.0)
end)

This would remove all peds for all players. Shove that into any client script in your resources (or make one, it’s trivial)

It is weird though - if you’re only using the “vanilla” resources that come with the FXServer package that should not be a thing regardless. Something’s probably borked in either your FiveM client or the server itself.

For example if I have this in my first script that and call to be launched this loop will have priority over the others or it must be launched last?

Citizen.CreateThread(function)
Citizen.Wait(0)
SetPedDensityMultiplierThisFrame(1.0)
end)

I reset my dedicated ovh and support my ensure that the machine and clean, my fivem and reinstall several times and use the fxserver recommend it.

The order in which you start this in regard to other resources should not matter as it’s a simple client-only script. Just make it and start it. I will be very puzzled if that still doesnt allow peds to spawn.

… that’s not every frame. The native explicitly says ThisFrame.

I’ll test it in a minute and keep you informed.

Well yeah, but if it’s ThisFrame, then to take effect consistently you need to run it every frame, hence the Wait(0) - that’s every single frame, although I think you know that :smiley:
And yes I tried actually running that native without the Wait some time ago, it crashed on me

You’re waiting 0 ms when the script is being created. The code is not being ran in a loop.

Yea, I would’ve thought yourself would know that, also.

CreateThread is not running the code every frame.

:man_facepalming:
Sorry, it’s way too late and I’m slow. That needs to be in a while true do loop, too.

Why do this via a client script? Just disable it in your startup command +set onesync_population false

1 Like

Here’s the proper script, @Akkua233 :

Citizen.CreateThread(function)
   while true do
   Citizen.Wait(0)
   SetPedDensityMultiplierThisFrame(1.0)
   end
end)

I do feel like an idiot sometimes, but don’t we all lol

1 Like

So I want peds right now , but they don’t spawn for any reason, so can a script force them to spawn?

Peds will always spawn by default. If they don’t, then you have a script disabling them

currently to launch the server I use its
bash run.sh +exec server.cfg +onesync_enableInfinity 1
s the onesync could cause a problem?

and I checked the 23 000 lua files I have and no function na that deletes them.

Yes, that is wrong. Replace +onesync_enableInfinity 1 with +set onesync on

3 Likes

Ok then I just bought a second dedicated machine for 70 euro WHEN THE BUG was there, I’m currently a very bad developer, I thank you SO MUCH for your help it should be a small topic because I’ve been looking for 1 week literally. :love_letter: :heart: :heart: :heart: :heart: