16.03.2014, 08:35
would be nicer if it had some math in it.
All what's left is Z 
(Height for 3d distance,in my code it's 2d,because it calculates x and y distance)
pawn Код:
// Too lazy for 3d,so ... 2d will be enough I guess ...
stock ClosestPlayerToPoint(Float:x,Float:y) {
new iClosest,d[MAX_PLAYERS],Float:x,Float:y,Float:z;
foreach(new i : Player) {
GetPlayerPos(i,x,y,z);
d[i]=Floatsqroot(Floatpower(x,2) + Floatpower(y,2));
if(d[i] < d[i-1]) {
iClosest=i;
}
}
return iClosest;
}

(Height for 3d distance,in my code it's 2d,because it calculates x and y distance)
