Code
stock GetClosestVehicle(playerid, Float:range)
{
new Float:p_X,Float:p_Y,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;
}
Alles anzeigen
Warum wird 1999 ausgegeben?