Public chat
#1

Howdy,

I'm trying to fix a public chat where the players color are the player of their nickname when they chat in the public chat. However when i try to fix this with SendPlayerMessageToAll, the message comes up x times as how many players are online. So if two players are online, the message comes up two times..

Code:

Код:
CMD:o(playerid, params[])
{
	if (g_StatusOOC && PlayerData[playerid][pAdmin] < 2)
	    return SendErrorMessage(playerid, "An administrator has disabled global OOC chat.");

	if (isnull(params))
	    return SendSyntaxMessage(playerid, "/o [global OOC]");

	if (PlayerData[playerid][pDisableOOC])
	    return SendErrorMessage(playerid, "You must enable OOC chat first.");

    if (strlen(params) < 128)
	{
        foreach (new i : Player) if (!PlayerData[i][pDisableOOC] && PlayerData[i][pCreated]) {
		SendPlayerMessageToAll(playerid, params);
		}
	}
	return 1;
}
I've tried to format it and some other ways, but it comes always out with the same output or errors. However this code does not give error, but i have the problem mentioned above.
Reply


Messages In This Thread
Public chat - by Swig - 03.06.2016, 17:21
Re: Public chat - by Onfroi - 03.06.2016, 17:29
Re: Public chat - by Swig - 03.06.2016, 17:49
Re: Public chat - by Konstantinos - 03.06.2016, 17:59

Forum Jump:


Users browsing this thread: 1 Guest(s)