GetClosestPlayer
#7

heres a better i think, shouldnt range be 99999 for the whole of san andreas?

pawn Код:
public GetClosestPlayer(p1)
{
    new Float:dis,Float:dis2,player;
    player = -1;
    dis = 99999.99;
    foreach(Player,x)
    {
        if(x != p1)
        {
            dis2 = GetDistanceBetweenPlayers(x,p1);
            if(dis2 < dis && dis2 != -1.00)
            {
                dis = dis2;
                player = x;
            }
        }
    }
    return player;
}

new closest = GetClosestPlayer(playerid);
        if(closest == -1 || GetDistanceBetweenPlayers(playerid,closest) > 7) return SendClientMessage(playerid,COLOR_RED,"There are no players closes enough");
Reply


Messages In This Thread
GetClosestPlayer - by armyoftwo - 23.12.2010, 10:18
Re: GetClosestPlayer - by cessil - 23.12.2010, 10:25
Re: GetClosestPlayer - by armyoftwo - 23.12.2010, 10:30
Re: GetClosestPlayer - by cessil - 23.12.2010, 10:45
Re: GetClosestPlayer - by rjjj - 23.12.2010, 11:33
Re: GetClosestPlayer - by armyoftwo - 24.12.2010, 13:36
Re: GetClosestPlayer - by The_Gangstas - 24.12.2010, 14:12

Forum Jump:


Users browsing this thread: 1 Guest(s)