Get Nearest Vehicle
#3

Quote:
Originally Posted by BigETI
Посмотреть сообщение
Go and learn the basics how to use loops and detect any vehicle position
Very hepful -.-

Use my function
pawn Код:
stock GetClosestVehicle(playerid, Float:range)
{
    new     Float:p_X;
    new     Float:p_Y;
    new     Float:p_Z;

    new     Float:Distance;
    new     Float:PretendentDistance = range +1;
    new     Pretendent;

    GetPlayerPos(playerid, p_X, p_Y, p_Z);

    for(new vehicleid=1; vehicleid < MAX_VEHICLES; vehicleid++)
    {
        Distance = GetVehicleDistanceFromPoint(vehicleid, p_X, p_Y, p_Z);

        if(Distance <= range && Distance <= PretendentDistance)
        {
            Pretendent = vehicleid;
            PretendentDistance = Distance;
        }
    }

    return Pretendent;
}
pawn Код:
new vehicleid;
vehicleid = GetClosestVehicle(playerid, 20);
This will find the nearest vehicle to you in radius of 20.
Reply


Messages In This Thread
Get Nearest Vehicle - by HondaCBR - 31.12.2011, 11:53
AW: Get Nearest Vehicle - by BigETI - 31.12.2011, 12:21
Re: AW: Get Nearest Vehicle - by WooTFTW - 31.12.2011, 12:35
Re: Get Nearest Vehicle - by HondaCBR - 31.12.2011, 12:40
Re: Get Nearest Vehicle - by HondaCBR - 31.12.2011, 13:01
Re: Get Nearest Vehicle - by WooTFTW - 31.12.2011, 13:10
AW: Get Nearest Vehicle - by BigETI - 31.12.2011, 13:19
Re: AW: Get Nearest Vehicle - by WooTFTW - 31.12.2011, 13:28
AW: Re: AW: Get Nearest Vehicle - by BigETI - 31.12.2011, 13:38
Re: Get Nearest Vehicle - by HondaCBR - 31.12.2011, 13:47

Forum Jump:


Users browsing this thread: 1 Guest(s)