whats wrong with this function?
#1

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;
}
Reply


Messages In This Thread
whats wrong with this function? - by BaubaS - 08.10.2011, 06:33
Re: whats wrong with this function? - by TheLazySloth - 08.10.2011, 06:59
Re: whats wrong with this function? - by BaubaS - 08.10.2011, 07:23
Re: whats wrong with this function? - by TheLazySloth - 08.10.2011, 07:49

Forum Jump:


Users browsing this thread: 1 Guest(s)