NPC cars disappering

Hello!

We have a problem that every NPC cars is dissapering… How to solve this?
We haven’t added anything, just one day it was like this! look at the clip!

Vehicles disappearing or not spawning at all? Cause there’s a difference.

If vehicles are disappearing, most likely you have a script with a blacklist of vehicles/peds/etc. and they’re removed on the fly, when you’re getting close to them.

If vehicles are not spawning at all, you have to remember how the vehicles generators work in GTA. You have to stay for a bit in one place, so the generators can start working and spawning vehicles. If you just fly around, the generators won’t spawn vehicles - optimization of the memory, etc.

Try to look for these natives in your code:

The above natives are directly related to amount of vehicles spawned around the player.

Also, for testing purposes, you could try GetAllVehicles() and see if there are any vehicles generated (maybe you don’t see them somehow?). If you use ESX, you can go and use ESX.Game.GetVehicles()

1 Like

Hello thanks!
If you look at the clip in fullscreen you can se that the car is spawning but when a player get closer they just disappearing.

Yeah, I just noticed that. I would bet on either a script which is removing all vehicles in a given radius OR this native RemoveVehicles....InArea()

Look for it in your codebase

Okay, when I searched for everything with RemoveVehicles in our server folder those came up!

I face the same problem on one server too. I made a clip that shows how NPCs and cars disappear.

Ghost cars… drivers of cars just disappear while driving past. Also the traffic seems to be very less almost non-existent. Other players and vehicles they are driving are visible. I have tried clearing cache.

Example of disappearing drivers:
https://www.youtube.com/watch?v=7c9U30IZdvY

How do I get to codebase? Before this happened I tried to install some car mods but suddenly it started to disappear. Please help

Do you see them disapear in your vision, or no any spawn?

Sorry for late reply, but for future reference - this looks exactly like a script that is removing specific Peds. Let’s say you don’t want to spawn police officers, army men, etc. Then the script is removing them on the fly. The issue is that majority of such scripts work in the way that they firstly spawn a Ped, only then they’re in the memory, and only then the script can read the model and remove it.

I had a similar situation (cars driving closer and then stopping without a driver) - this was caused by one script that unsuccessfully tried to optimize the amount of Peds spawning.

You have to carefully check your scripts, line-by-line. It’s often wise to understand what scripts on your server do.

By “codebase” I basically meant your servers’ files.