Help with Team chat
#1

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
Reply
#2

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

EDIT: 'd
Reply
#3

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
Reply
#4

Worked, thank ya.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)