Getting pos with least distance
#1

I've got this code:
Code:
					new Float:pos[3], Float:Distance, Float:MaxDistance = 99999.0, LowestID = -1;
					GetPlayerPos(playerid, pos[0], pos[1], pos[2]);

...

							for(new i; i < sizeof(Pos247); i++)
							{
								Distance = PointToPoint3D(pos[0], pos[1], pos[2], Pos247[i][0], Pos247[i][1], Pos247[i][2]);
								printf("%f %f", Distance, MaxDistance);
								if(Distance < MaxDistance)
								{
									Distance = MaxDistance;
									LowestID = i;
								}
							}
But the console shows:
Code:
[21:29:06] 2848.760009 99999.000000
[21:29:06] 2056.619873 99999.000000
[21:29:06] 1066.780151 99999.000000
[21:29:06] 1646.422973 99999.000000
[21:29:06] 2312.666259 99999.000000
[21:29:06] 5244.834960 99999.000000
[21:29:06] 2857.414306 99999.000000
[21:29:06] 1411.058227 99999.000000
[21:29:06] 1122.167846 99999.000000
[21:29:06] 1003.160583 99999.000000
[21:29:06] 1235.255126 99999.000000
[21:29:06] 1331.628173 99999.000000
[21:29:06] 2219.748046 99999.000000
- the if condition is not performed...
Reply


Messages In This Thread
Getting pos with least distance - by ziomal432 - 16.04.2010, 19:41
Re: Getting pos with least distance - by M4S7ERMIND - 16.04.2010, 20:45

Forum Jump:


Users browsing this thread: 1 Guest(s)