SA-MP Forums Archive
Help with Team chat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with Team chat (/showthread.php?tid=454591)



Help with Team chat - GwENiko - 29.07.2013

pawn Код:
CMD:t(playerid, params[])
{
    new string[128], aname[MAX_PLAYER_NAME];
    if(sscanf(params, "s[128]", string)) return SendClientMessage(playerid, 0xFF0000AA, "[USAGE]: /t <text>");
    {
    GetPlayerName(playerid, aname, sizeof(aname));
    format(string, sizeof(string), "[Team Chat]: %s: %s", aname, string);
        }
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(pClan[i] == 1 || pClan[i] == 2 || pClan[i] == 0)
                {
                SendClientMessage(i, 0xFF7F50AA, string);
                }
        }
        return 1;
}
Well, every team is sharing a single team chat? i mean, even players using another team are able to see that chat


Re: Help with Team chat - [XST]O_x - 29.07.2013

pawn Код:
if(pClan[i] == pClan[playerid])
This should work.

EDIT: 'd


Re: Help with Team chat - Jstylezzz - 29.07.2013

pawn Код:
if(pClan[i] == 1 || pClan[i] == 2 || pClan[i] == 0)
This if statement will do the following:

If the value of pClan is either 1, 2 or 0, the message will be shown to the player.
I think you want to change that line to
pawn Код:
if(pClan[i] == pClan[playerid])
This will send the message only to players in the same 'pClan'.

EDIT: [XST]O_x beat me to it ;P


Re: Help with Team chat - GwENiko - 29.07.2013

Worked, thank ya.