31.08.2014, 19:30
I'm using this to find one nearest vehicle, but how can I convert it to find all vehicles in a given range?
pawn Код:
stock GetNearestVehicle(playerid, Float:range)
{
new Float:x, Float:y, Float:z, Float:Distance;
new nearbyveh = -1;
for(new i=1; i < MAX_VEHICLES+1; i++)
{
if(i == GetPlayerVehicleID(playerid)) continue;
GetVehiclePos(i, x, y, z);
Distance = GetPlayerDistanceFromPoint(playerid, x, y, z);
if(Distance <= range)
{
nearbyveh = i;
range = Distance;
}
}
return nearbyveh;
}