Custom function problem
#1

i use this:
Code:
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;
}
but it returned me 1999 all time. I check at less than 10m from an vehicle end it tell me that nearrest vehicle is 1999 too

Why?
Reply


Messages In This Thread
Custom function problem - by moof2010 - 05.05.2014, 19:30
Re: Custom function problem - by Smileys - 05.05.2014, 19:39
Re: Custom function problem - by Vince - 05.05.2014, 19:48
Re: Custom function problem - by Teemo - 05.05.2014, 19:50
Re: Custom function problem - by Konstantinos - 05.05.2014, 19:51
Re: Custom function problem - by Smileys - 05.05.2014, 19:51
Re: Custom function problem - by moof2010 - 05.05.2014, 19:54
Re: Custom function problem - by moof2010 - 05.05.2014, 20:08
Re: Custom function problem - by Konstantinos - 05.05.2014, 20:18
Re: Custom function problem - by moof2010 - 05.05.2014, 20:37

Forum Jump:


Users browsing this thread: 1 Guest(s)