Quote:
Originally Posted by knackworst
pawn Код:
new szStr[128], szPName[MAX_PLAYER_NAME]; GetPlayerName(playerid, szPName, MAX_PLAYER_NAME); format(szStr, sizeof(szStr), "{4169FF}%s:{FFFFFF} %s", szPName, text[0]);
for(new i; i < MAX_PLAYERS; i++)//if you use foreach use that, if you don't - then you should start. if(IsPlayerConnected(i)) SendClientMessageToAll(COLOR_WHITE,szStr);
|
Your code will send a message to all players each time it finds a connected player causing the chat to be flooded.
pawn Код:
public OnPlayerText(playerid, text[]) {
new
cString[128],
pName[MAX_PLAYER_NAME]
;
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(cString, sizeof(cString), "%s(%d): %s", pName, playerid, text);
SendClientMessageToAll(-1, cString);
return 0;
}