Checking who's near you.
#4

You don't need GetDistance.

Using foreach.
pawn Код:
CMD:near(playerid, params[])
{
    new
        Float:x, // floats for the playerid's position
        Float:y,
        Float:z,
        name[24] // a new string for the all the names
    ;
    SendClientMessage(playerid, -1, "-------[ Players Near You ]-------");
    GetPlayerPos(playerid, x, y, z); // We get the position of the player and store them into the floats
    foreach(Player, i) // we loop through all the players
    {
        // and if all the players are within 10 feet of the playerid who typed this command's position.
        if(IsPlayerInRangeOfPoint(i, 10.0 ,x, y, z))
        {
            // then it will get their name and send it to who ever typed the command
            GetPlayerName(i, name, 24);
            SendClientMessage(playerid, -1, name);
            // since this is a loop
            // this code will be repeated
            // for EVERY player that is near whoever typed the command
        }
    }
    return 1;
}
Reply


Messages In This Thread
Checking who's near you. - by Shockey HD - 11.05.2012, 02:21
Re: Checking who's near you. - by JaKe Elite - 11.05.2012, 02:41
Re: Checking who's near you. - by Yuryfury - 11.05.2012, 02:46
Re: Checking who's near you. - by ReneG - 11.05.2012, 03:31
Re: Checking who's near you. - by Shockey HD - 11.05.2012, 03:35

Forum Jump:


Users browsing this thread: 1 Guest(s)