Problem with teamchat!
#8

Here another huge pice of code

pawn Код:
enum {
    GROVE,
    BALLA,
    VAGOS,
    AZTECAS,
    POLICE,
    RIFAS,
    LOCO,
    DEALERS
}
pawn Код:
#define INVALID_TEAM (-1)
pawn Код:
stock const tData[][] = {
    {0x00AA00FF, "Groove"},
    {0x800080FF, "Ballas"},
    {0xFFFF00FF, "Vagos"}
    //....
};
pawn Код:
stock gTeam[MAX_PLAYERS] = {INVALID_TEAM, ...};
pawn Код:
//OnPlayerText
    if(text[0] == '!') {
        new
            string[180],
            team = gTeam[playerid],
            color = tData[team][0]
        ;
        GetPlayerName(playerid, string, MAX_PLAYER_NAME);
        format(string, sizeof string, "[%s] %s:{FFFFFF} %s", tData[team][1], string, text[1]);

        for(new i; i != MAX_PLAYERS; ++i) {
            // due to the fact that all disconnected players got an invalid team (-1)
            // we can skip the IsPlayerConnected check
            if(gTeam[i] == team) {
                SendClientMessage(i, color, string);
            }
        }
        return false;
     }
pawn Код:
//OnPlayerDisconnect
    gTeam[playerid] = INVALID_TEAM;
Reply


Messages In This Thread
Problem with teamchat! - by Twisted_Insane - 31.03.2012, 13:10
Re: Problem with teamchat! - by vyper - 31.03.2012, 14:18
Re: Problem with teamchat! - by sjvt - 31.03.2012, 14:31
Re: Problem with teamchat! - by Twisted_Insane - 31.03.2012, 14:59
Re: Problem with teamchat! - by Randyy - 31.03.2012, 15:02
Re: Problem with teamchat! - by Twisted_Insane - 31.03.2012, 15:08
Re: Problem with teamchat! - by Randyy - 31.03.2012, 15:14
AW: Problem with teamchat! - by Nero_3D - 31.03.2012, 15:16
Re: Problem with teamchat! - by Randyy - 31.03.2012, 15:19
Re: Problem with teamchat! - by Twisted_Insane - 31.03.2012, 15:25

Forum Jump:


Users browsing this thread: 1 Guest(s)