15.07.2010, 10:31
pawn Код:
stock FindClosestVehicle(playerid)
{
new
Float:x, Float:y, Float:z,
closest = -1;
for(new a = 0; a < MAX_VEHICLES; a++)
{
GetVehiclePos(a, x, y, z);
if(a != YOUR_VEHICLEID_OR_ARRAY/VARIBLE && IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
closest = a;
}
}
if(closest != -1) return closest;
return INVALID_VEHICLE_ID;
}