31.03.2012, 15:16
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;