Checking if a player is close
#2

use this func

PHP код:
forward GetClosestPlayer(p1);// top
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(
!= p1)
            {
                
dis2 GetDistanceBetweenPlayers(x,p1);
                if(
dis2 dis && dis2 != -1.00)
                {
                    
dis dis2;
                    
player x;
                }
            }
        }
    }
    return 
player;

and u can use this func like that

PHP код:
GivePlayerMoney(GetClosestPlayer(playerid), 100); // give $100 to closest player 
Reply


Messages In This Thread
Checking if a player is close - by liam1412 - 02.04.2013, 17:46
Re: Checking if a player is close - by brawrr - 02.04.2013, 17:51
Re: Checking if a player is close - by Finn - 02.04.2013, 19:06
Re: Checking if a player is close - by MP2 - 02.04.2013, 19:31
Re: Checking if a player is close - by liam1412 - 03.04.2013, 06:25

Forum Jump:


Users browsing this thread: 1 Guest(s)