Help with Teamchat
#4

A better way to do teamchat (IMO) would be using OnPlayerText something like this,
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#')
    {
        new
            s[MAX_PLAYER_NAME],
            team = GetPlayerTeam(playerid);
           
        GetPlayerName(playerid, s, MAX_PLAYER_NAME);
        format(text, 128,"[TEAMCHAT] %s: %s", s, text[1]);
       
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i))continue;
            if(GetPlayerTeam(i) == team)//if you use a "gTeam" type var use that ie, if(gTeam[i] == gTeam[playerid])
                SendClientMessage(i,0x00D7FFFF, text);
        }
        return 0;
    }
    return 1;
}
To use team chat just type #hello team. Anything after hash '#' gets send to players on the same team of the sender.
Reply


Messages In This Thread
Help with Teamchat - by SanAndreasVille - 20.02.2011, 00:12
Re: Help with Teamchat - by rjjj - 20.02.2011, 00:18
Re: Help with Teamchat - by SanAndreasVille - 06.03.2011, 10:04
Re: Help with Teamchat - by iggy1 - 06.03.2011, 10:25

Forum Jump:


Users browsing this thread: 1 Guest(s)