Hi all! I got a question that is all about there is a way to get the id of a vehicle that i'm not sitting in it or no one sitting in it! Example: get vehicle id what is in this circle-> float
, float:y... So i add the coordinates and get the vehicle id what is in that circle. Sorry for my bad english, thanks for helping.
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 != MAX_VEHICLES; i++)
{
if((fDistance = GetVehicleDistanceFromPoint(i, fX, fY, fZ)) < fFinalDistance)
{
fFinalDistance = fDistance;
iClosestID = i;
}
}
return iClosestID;
}