Hello,
I’m trying to retrieve all vehicles in the world using GetAllVehicles() server-side function without any success, it correctly returns an table but is empty. I’ve used that yesterday without any problems and right now impossible to get any vehicles in world. I really don’t get it, I’ve spawned a networked vehicle btw.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local veh = GetAllVehicles()
print(json.encode(veh))
print(type(veh))
print(#veh)
end
end)
Result: https://i.imgur.com/04SF4N0.png
Citizen.CreateThread(function()
while true do
Wait(0)
for _, entity in pairs(GetAllVehicles()) do
print(entity)
print(#entity)
print(type(entity))
end
end
end)
Result: nothing
Thanks.
EDIT: All GetAll*() aren’t working at all.
EDIT2: It need Onesync enabled to work.