Vehicle does not spawn sometimes (OneSync INF)

Client

Using canary? no

Server

Operating system: win10
Artifact version: 2683

Incident

Summary: When you go to a location which a vehicle suppose to be found, if it’s being owned by someone else (NetworkGetEntityOwner) and the owner is far away from you ( > 420 meters or not in your ‘scope’) it’ll not appear to you until the owner will enter your scope.
Expected behavior: First expected behavior: Vehicles should appear even if the owner is far away.
Second expected behavior: The server will change the entity owner to the closest player (Right now, the server changes the entity owner only if both players are in the same scope).
Actual behavior: Vehicles don’t appear until the owner enters your scope.
Steps to reproduce:

  1. Spawn a vehicle far away from you ( > 420 meters ), while someone else is closer to the spawn position.
  2. Make sure the other player is the entity’s owner (NetworkGetEntityOwner)
  3. Go to the vehicle position (You won’t see the vehicle)
  4. Tell the owner to come closer to you (You will see it spawns when he enters the scope)

Server/Client? Probably server

Any additional info: I’ll record a video later.

Video added:
run = load function on server side

that’s quite old

Just updated to the latest version, when no one is close to the vehicle spawn location, it fails to spawn it at all, and if you are close enough to spawn it, sometimes it’s being spawned with the heading of 0.

repro? as this was tested and working

Yes, the video shows that when I tried to spawn a vehicle on my coords (I’m alone in the server) and it worked, but when I tried to spawn at 0 0 70, it didn’t spawn, when I teleport there, couldn’t see it, and DoesEntityExist returned false

Server version - v1.0.0.2711

ah, that still isnt latest, CF cache is a horrible thing at that

there’s also some other odd issues with recent servers that only show with some amount of players, posting a minimal script to do what you’re doing might help though

I guess this is enough, just make sure no one is close to (847.0, 6494.0, 22.22)

RegisterCommand("otest", function(a)
SetEntityCoords(a, 0.0, 0.0, 70.0)
Wait(500)
local veh = CreateVehicle(`t20`, 847.0, 6494.0, 22.22, 0.0, true, true)
Wait(1000)
local b = DoesEntityExist(veh)
print(veh, tostring(b))
if b then DeleteEntity(veh) end
end, false)

is this on server or client?

The code on server, the execution on client.

huh?

does that mean it’s a client script or

It is a command, you load it on the server and execute it in the client. The server runs the code and the print will be printed on the server console.

server_script “test.lua”

@nta
Update for the last FiveM version(cl - 2745 | sv - 2744):

When you leave the vehicle’s scope, always on the first time the owner moves to the server (-1), and when you come back to the vehicle scope you can see the vehicle as expected, but on the second time, it just deletes it, and it’s never coming back.

btw, I don’t think moving the owner to the server is a good idea at all, because I use the owner to set some values on the vehicle, for example, it’s livery or engine health (and there’s no other way to do it atm). I think a player should be the owner of an entity, or perhaps, SetVehicleLivery and SetVehicleEngineHealth, etc on the server-side.

seems like I reported the same issue here: Vehicle gets deleted after transferring Ownership to the server twice

Looks like it, but the real issue to me is that when no one is the owner, you can’t change a lot of things, like livery, body health, engine health, etc…