Loop issue
#6

GetPlayerPos, not GetVehiclePos. You GetPlayerPos each iteration of the loop, but the player won't have the time to move during loop execution..so it's pointless to get his pos again and again.

And yeah ok sorry for that, you don't see GetPlayerPos, that is because it's used by the function PlayerToPoint.

GetPlayerPos before the loop, then use a simple distance function inside the loop.

ex:
pawn Код:
new Float:px, Float:py, Float:pz, Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, px, py, pz);
GetVehiclePos(CarInfo[c][cID], cx, cy, cz);

for (blablabla)
  if (distance(px, py, pz, cx, cy, cz) < 3.0)
Reply


Messages In This Thread
Loop issue - by Dujma - 21.02.2009, 09:55
Re: Loop issue - by Finn - 21.02.2009, 10:44
Re: Loop issue - by Dujma - 21.02.2009, 10:48
Re: Loop issue - by yom - 21.02.2009, 10:55
Re: Loop issue - by Dujma - 21.02.2009, 10:58
Re: Loop issue - by yom - 21.02.2009, 11:01
Re: Loop issue - by Dujma - 21.02.2009, 11:03

Forum Jump:


Users browsing this thread: 1 Guest(s)