Here is my GetVehicles function :
function GetVehicles()
local vehicles = {}
local handle, vehicle = FindFirstVehicle()
local success = nil
repeat
table.insert(vehicles, vehicle)
success, vehicle = FindNextVehicle(handle)
until not success
EndFindVehicle(handle)
return vehicles
end
Sometimes it works as expected (it returns an array with vehicles) and sometimes it returns an array with 0 as only element.
For me it works great until i restart game many times without quitting fivem (first times it returns vehicles and after {0})
For some people it returns always {0}
What am I doing wrong with these natives ?