Quote:
Originally Posted by milanosie
Untested, modify it to your liking to return 0 if dis > 10
pawn Code:
public GetClosestVehicleFromPlayer(playerid) { new Float:dis = 99999999.0; new veh = -1; new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for(new i = 1; i < MAX_VEHICLES; i++) { new Float:distance = GetVehicleDistanceFromPoint(i, x, y, z); if(distance < dis) { dis = distance; veh = i; } } return veh; }
|
Thank you, I'll edit it now :3