A small tip on calculating the distance to other cars:
You have 3 coordinates for each car: X, Y, Z. If you are good with geometry you can get the formula to calculate the distance between two points using 3 coordenates. But, in this context that is just a waste of processing time and power.
First of all, you can totally forget about the Z component. Surface is not totally plain, but comparing car's relative positions you would notice that the difference in heigth is irrelevant here, and most of all when you are looking for a car that should be close to you (therefore the heigth would be very close). Now you only have to compare positions using two coordenates, which simplifies the whole thing a lot (in terms of arithmetic operations needed).
With two coordenates you only need to apply the Pythagoras' theorem. But we can simplify it even more:
Car1 pos:
x1,y1
Car2 pos:
x2,y2
distance_in_meters = square_root ( (x1-x2)^2 + (y1-y2)^2 ) / 65536
This would give us the distance in meters (because of the "/65536")
But in our case we don't care about the actual distance in meters or any other measure unit. The only thing we want to know is "the closest car", not "how far is each car". So first of all we get rid of the "/65536". And then we change:
lfs_distance^2 = (x1-x2)^2 + (y1-y2)^2
We calculate "lfs_distance^2", and that's what we are going to compare. This way we don't need to calculate square roots or convert anything to meters.
The only thing you need to take care is not to cause an overflow here. For this you should choose the appropiate data types, and maybe divide the original x1,y1,x2,y2 by some factor like 2^17 to prevent getting too high. This would cause you to lose precission (precission this way would be 2 meters in each X and Y coordenate), but you won't be needing much precission.