08.10.2011, 06:33
thread says all. it always returning 0, instead of vehicleid or invalid_vehicle_id value
pawn Код:
stock GetClosestVehicle(playerid, Float: fRadius) // by RyDeR`
{
new
iClosestID = INVALID_VEHICLE_ID,
Float: fFinalDistance,
Float: fDistance,
Float: fX,
Float: fY,
Float: fZ;
GetPlayerPos(playerid, fX, fY, fZ);
fFinalDistance = fRadius;
for(new i; i != Cars; ++i)
{
if((fDistance = GetVehicleDistanceFromPoint(i, fX, fY, fZ)) < fFinalDistance)
{
fFinalDistance = fDistance;
iClosestID = i;
}
}
return iClosestID;
}