For a good bug report you should probably include:
- Client (production/canary) and FXServer version:
Artifacts: 6018 but also versions below
- What you expected to happen
When creating a vehicle with CREATE_AUTOMOBILE it should spawn the vehicle empty at the location where I told it to spawn.
- What actually happens
Sometimes an random NPC wil spawn inside the vehicle and it will drive away with the vehicle.
- Category of bug (eg. client, server, weapons, peds, native)
- Reproducible steps, preferably with example script(s)
- Create an automobile with CREATE_AUTOMOBILE or CreateVehicleServerSetter
- I thought it was only me, but I saw in the CFX discord that more people have this problem. So I thought I’d report it.
- It seems to happen more frequently when spawning the vehicle on an traffic / vehicle node. (Where NPC’s drive) and when spawning an vehicle that the population there drives. (For example I have never had this problem with a T20, but more frequently with a panto or a baller.
I could not reproduce this since the steps aren’t sufficient (needs coordinates, model, and maybe other players around?), but fix(gamestate/server): server-created vehicle 'status' field · citizenfx/[email protected] · GitHub might be a potential fix for this.
It should be in server releases starting at 6033.
I have tried it on server build 6033 and it’s still happening.
The best I can try in reproducing this is as following:
- Go to a street where you block oncoming traffic, so that NPC’s need to stop for you because you are blocking their way.
- Watch around and look for an vehicle that is driving around in the population.
- Spawn that vehicle with Create_automobile in front of you en try to set yourself in it. (I heard for other that it’s happening with createvehicleserversetter also, but I’m not using that)
- With a bit of ‘luck’ after a couple places / times, NPC’s will spawn inside it and drive away.
I understand that it is difficult to fix this issue, when there isn’t an 100% reproduction step. But I will try if I can find a way.
Edit: I just tried it in North Los Santos, Around the central bank, and Vinewood boulevard en up. With the Obey Rocoto, the Beejay XL and the Baller, and when blocking NPC traffic they are taken by an NPC a lot of the time.
Can you at least provide a script with exact coords and all for this + specify if this requires any player count over one, and check this on a clean server and not something with other content?
I have tested it with the resource below with a clean server (except for spawnmanager etc.) and it is also happening. (Usage /spawnvehicle [vehiclemodel ex. baller or panto])
This happens when I am alone on my localhost server. So there is no need for a player count over one.
I don’t have exact coords, as it happens at random moments, and can’t get it to work all the time. The way I found out it happens for me the most is when blocking NPC traffic (or being at least on a traffic node / road) and than spawning vehicles that drive around in that area.
Sorry if it’s not easy to
onesyncvehspawner.zip (1.5 KB)
I can also confirm the same bug happening on FXServer 5977, I use the native in two ways, one is to spawn in frozen, static entities at a cardealer, the peds spawn inside (happened a lot with Panto, but it’s not specific to it), turns on the engine and tries to drive away.
My other issue is within the same script, if I call the native on a coord regardless of where it is in the world (200+ spawnpoints, no specific place it happens more than anywhere else), and when I arrive to the area (close enough for the car to actually spawn), the NPC is driving away with it.
On my end I have no real way to reproduce it, it’s random occurance, with only me on my server.
It has also happens with multiple players online (Seems to be a bit more frequent the more clients there is around, happened maybe 3 times during 1 hour testing of 30~ vehicles spawned far, far away)
Tested on build 6033 with a fresh default server, no other players.
The repro is to spawn a car near a car that is the same model and that has spawned naturally and with an npc driving it.
This resource makes it a little easier as I am streaming popgroups.ymt to ensure that only buffalos are spawning.
/test a few times and it should happen before long, might happen 3 times in a row or it may take 10 attempts.
local playerPed = GetPlayerPed(source)
local coords = vector3(50, 50, 72)
local playerPos = SetEntityCoords(playerPed, coords.x, coords.y, coords.z)
local vehicleType, popType, model
local vehicles = GetAllVehicles()
for i = 1, #vehicles do
local veh = vehicles[i]
local ped = GetPedInVehicleSeat(veh, -1)
if ped > 0 then
vehicleType = GetVehicleType(veh)
model = GetEntityModel(veh)
local num = 0
while true do
local veh = CreateVehicleServerSetter(model, vehicleType, coords.x, coords.y, coords.z, 90.0)
local ped = GetPedInVehicleSeat(veh, -1)
num = num + 1
if ped > 0 then
vehicle = veh
if num == 100 then
return print(('failed to spawn %s (%d) with random ped after %d attempts (try again)'):format(vehicleType, model, num))
print(('spawned %s (%d) with random ped after %d attempts'):format(vehicleType, model, num))
spawned automobile (1909141499) with random ped after 1 attempts
failed to spawn automobile (1909141499) with random ped after 100 attempts (try again)
spawned automobile (914654722) with random ped after 1 attempts
failed to spawn automobile (914654722) with random ped after 100 attempts (try again)
spawned automobile (1909141499) with random ped after 36 attempts
spawned automobile (1909141499) with random ped after 27 attempts
Thanks for the repro scripts, will look into it whenever I next get a chance to.
I didn’t realize ‘sometimes’ rather meant <5% of cases, so after failing to have it happen 6 times in a row I decided to not try to confirm if this change helped.
O sorry by bad, I should have defined ‘sometimes’ a bit more precisely.