Race Position
#3

Quote:
Originally Posted by xDeadlyBoy
Посмотреть сообщение
checking who is closest to a point:
pawn Код:
new ClosestID = INVALID_PLAYER_ID;
new Float:ClosestDis = 0;
for(new i; i < GetMaxPlayers(); i++)
{
if(ClosestID == INVALID_PLAYER_ID || GetPlayerDistanceToPoint(i, X, Y, Z) < ClosestDis)
{
ClosestID = i;
ClosestDis = GetPlayerDistanceToPoint(i, X, Y, Z);
}
}
and there is the function:
pawn Код:
stock GetPlayerDistanceToPoint(playerid, Float:X, Float:Y, Float:Z)
{
  new Float:XP,Float:YP,Float:ZP;
  GetPlayerPos(playerid,XP,YP,ZP);
  return (XP - X) + (YP - Y) + (ZP - Z);
}
Thanks for the reply, not idealy what I was looking for though.

Quote:
Originally Posted by ******
Посмотреть сообщение
Check in the old YSI system, the YSI_races.own file had an experimental function for this, though I don't think I even massively tested/completed it, but it's a start.
YSI:Races looks quite handy actually in more than one way. Thank you.
Reply


Messages In This Thread
Race Position - by Infamous - 13.05.2011, 10:05
Re: Race Position - by xDeadlyBoy - 13.05.2011, 10:12
Re: Race Position - by Infamous - 13.05.2011, 11:04

Forum Jump:


Users browsing this thread: 1 Guest(s)