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.