11.05.2012, 03:31
You don't need GetDistance.
Using foreach.
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;
}