GetClosestPlayer
#2

here's mine
pawn Код:
stock GetClosestPlayer(playerid,Float:limit)
{
    new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
    GetPlayerPos(playerid,x1,y1,z1);
    new Float:Range = 999.9;
    new id = -1;
    foreach(Player,i)
    {
        if(playerid != i)
        {
            GetPlayerPos(i,x2,y2,z2);
            new Float:Dist = GetDistanceBetweenPoints(x1,y1,z1,x2,y2,z2);
            if(floatcmp(Range,Dist) == 1 && floatcmp(limit,Range) == 1)
            {
                Range = Dist;
                id = i;
            }
        }
    }
    return id;
}
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)