Teamchat spam in IRC
#1

Hi there.

Iґm using this script for teamchat:

Код:
	if(strcmp(cmdtext, "/t", true))
	{
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(MyVar[i] == MyVar[playerid])
				{
					new pname[26];
					GetPlayerName(playerid, pname, sizeof(pname));
					new str[256];
					format(str, 256, "[TEAM] %s: %s", pname, cmdtext[3]);
					SendClientMessage(i, 0x2641FEAA, str);
					IrcSay(str);
				}
			}
		}
		return 1;
	}
But unfortunately, when someone writes something on /t, the IRC channel is getting spammed with it. (IrcSay(str). Why?
Reply
#2

It's because you're calling ircSay whenever you send someone a team message.

Код:
if(strcmp(cmdtext, "/t", true))
{
	new
		sPlayerName[MAX_PLAYER_NAME],
		sOutput[128];
		
	GetPlayerName(playerid, sPlayerName, sizeof sPlayerName);
	format(sOutput, sizeof sOutput, "[TEAM] %s: %s", sPlayerName, sOutput);
	
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(MyVar[i] == MyVar[playerid])
			{
				SendClientMessage(i, 0x2641FEAA, sOutput);
			}
		}
	}

	IrcSay(sOutput);
	return 1;
}
Also, learn to name variables appropriately
Reply
#3

Good job, now the text doesnt display any more.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)