09.07.2013, 00:45
Can Somebody show me to create that function ??
GetClosestVehicleFromVehicle(vehicleid)
{
new
Float:X,
Float:Y,
Float:Z,
Float:Distance,
Float:DefaultDistance = 999999999.9,
vID = INVALID_VEHICLE_ID;
GetVehiclePos(vehicleid,X,Y,Z);
for(new carid = 1; carid != MAX_VEHICLES; carid++)
if(IsValidVehicle(carid))
{
Distance = GetVehicleDistanceFromPoint(carid, X, Y, Z);
if(Distance < DefaultDistance)
{
DefaultDistance = Distance;
vID = carid;
}
}
return vID;
}