01.01.2013, 09:32
Your code wouldn't work because if there was 3 people:
ID 0
ID 1
ID 2
Lets say ID 1 quit then the player variable would change to 2 but it would only reach ID 0 because ID 2 is out of the loop. You could either use foreach or the following:
Your code also didn't work because you don't get the players position .
ID 0
ID 1
ID 2
Lets say ID 1 quit then the player variable would change to 2 but it would only reach ID 0 because ID 2 is out of the loop. You could either use foreach or the following:
pawn Код:
public OnPlayerText(playerid, text[])
{
new name[24], message[128];
new Float:x, Float:y, Float:z;
GetPlayerName(playerid, name, sizeof(name));
format(message, sizeof(message), "%s says, \"%s\"", name, text);
GetPlayerPos(playerid, x, y, z);
for (new id; id<MAX_PLAYERS; id++)
{
if (!IsPlayerConnected(id)) continue;
if(IsPlayerInRangeOfPoint(id, 20.0, x, y, z)) SendClientMessage(id, -1, message);
}
return 0;
}