11.03.2015, 23:33
Oh yeah i failed, write the function like this:
Greekz
Code:
stock GetClosestPlayer(playerid) { new Float:p[3],i,Float:x,Float:t=70.0,tmp; GetPlayerPos(playerid,p[0],p[1],p[2]); for(; i<MAX_PLAYERS; i++) { if(!IsPlayerConnected(i) || i == playerid) continue; x = GetPlayerDistanceFromPoint(i,p[0],p[1],p[2]); if(x < t) t = x,tmp=i; } return (t==70.0)?INVALID_PLAYER_ID:tmp; }