21.12.2013, 10:56
if your trying to get the distance between a single object and the player why are you looping? (hence the function's name?) and the reason what you're trying to do won't work is because you don't check which object is the nearest (3.5) IN the function.
loop, get objects distance from player, check if < 3.5, return objectid
loop, get objects distance from player, check if < 3.5, return objectid