02.01.2011, 23:00
I don't know why it's saying Eagle, but there's a logical problem with your code anyway.
It'll stop running as soon as it hits a player that is not connected, therefore anyone with an ID higher than that of the not connected ID, will not hear the text.
Instead I suggest you use a counter to check how many people received the message, and if none, then tell him that nobody heard you, for example.
It'll stop running as soon as it hits a player that is not connected, therefore anyone with an ID higher than that of the not connected ID, will not hear the text.
Instead I suggest you use a counter to check how many people received the message, and if none, then tell him that nobody heard you, for example.
pawn Код:
public OnPlayerText(playerid, text[])
{
new name[MAX_PLAYER_NAME], counter;
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(text, 128, "%s : %s", name, text);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for (new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i,200.0,x,y,z))
{
SendClientMessage(i, GetPlayerColor(playerid), text);
counter++;
}
}
}
if(counter < 2) SendClientMessage(playerid, COLOR_WHITE, "[SERVER] : Nobody heard you, please use /shout or /me!"); // Note we're checking if it's less than 2, because the player will always hear himself speak, but that doesn't mean someone else heard him.
return 0;
}