21.01.2010, 19:06
hi i will like to know whats the code for the command to make a team chat on ma server because i was lookin ofr it and it doesnt work i will apreciate it thanks...
//Add OnPlayerText
//Team Chat
if(text[0] == '!')
{
text[0] = ' ';
for(new i = 0; i <= MAX_PLAYERS; i++ )
{
new str[512];
if(gTeam[playerid] == 255)
{
SendClientMessage(playerid,<COLOR>,"You just used \"!\" for team chat, but you are not in any team right now!");
return 0;
}
if(gTeam[playerid] == gTeam[i])
{
format(str,512,"[Team] %s:%s",PlayerName(playerid),text); /* note that there is no space after the first "%s:" to not make the message look weird for having to much space*/
SendClientMessage(i, <COLOR>, str);
}
}
return 0;
}
public OnPlayerText(playerid, text[])
{
if(text[0] == '!')
{
if(gTeam[playerid] == 255)
{
SendClientMessage(playerid, 0xFFFF00FF, "You just used \"!\" for team chat, but you are not in any team right now!");
return 0;
}
text[0] = ' ';
new str[128];
format(str, sizeof(str), "[Team] %s:%s", PlayerName(playerid), text);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[playerid] == gTeam[i])
{
SendClientMessage(i, 0xFFFF00FF, str);
}
}
return 0;
}
return 1;
}
stock PlayerName(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}