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:
Spawn a vehicle far away from you ( > 420 meters ), while someone else is closer to the spawn position.
Make sure the other player is the entity’s owner (NetworkGetEntityOwner)
Go to the vehicle position (You won’t see the vehicle)
Tell the owner to come closer to you (You will see it spawns when he enters the scope)
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.
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
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)
@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.
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…