08.04.2017, 23:26
so don't ask why I need this but I need it I have made this thing so that it give me the near players from 100meters away from me but this give me 1 player what if I need to get all the players that are near me what should I do here is the code:
PHP код:
CMD:pnear(playerid, params[])
{
new string[64], Float:tx[MAX_PLAYERS], Float:ty[MAX_PLAYERS], Float:tz[MAX_PLAYERS], tname[MAX_PLAYER_NAME];
if(adlvl(playerid) <5) return 0;
SendClientMessage(playerid, COLOR_YELLOW, "* Listing all Player(s) within 100 meters of you...");
for(new i=1; i<MAX_PLAYERS ; i++)
{
GetPlayerPos(i, tx[i], ty[i], tz[i]);
if(IsPlayerInRangeOfPoint(playerid, 100.0, tx[i], ty[i], tz[i]) && i!=playerid)
{
GetPlayerName(i, tname, sizeof(tname));
format(string, sizeof(string), "Playerid: %d | Name: %s", i, tname);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}