GetClosestPlayer
#2

pawn Код:
forward GetClosestPlayer(p1);
public GetClosestPlayer(p1)
{
    new x,Float:dis,Float:dis2,player;
    player = -1;
    dis = 99999.99;
    for (x=0;x<MAX_PLAYERS;x++)
    {
        if(IsPlayerConnected(x))
        {
            if(x != p1)
            {
                dis2 = GetDistanceBetweenPlayers(x,p1);
                if(dis2 < dis && dis2 != -1.00)
                {
                    dis = dis2;
                    player = x;
                }
            }
        }
    }
    return player;
}
Reply


Messages In This Thread
GetClosestPlayer - by StrickenKid - 25.02.2009, 00:06
Re: GetClosestPlayer - by Norn - 25.02.2009, 00:10
Re: GetClosestPlayer - by StrickenKid - 25.02.2009, 00:14

Forum Jump:


Users browsing this thread: 1 Guest(s)