07.12.2010, 00:48
first make sure the 'teamid[MAX_PLAYERS]' is at the top of your GM/FS... then at the OnPlayerConnect define players teamid...( teamid[playerid]={the teams id} // if he has no team define it -1
then..
then..
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '$' && teamid[playerid]!=-1)
{
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Team Chat: %s: %s",string,text[1]);
return SendMessageToTeam(COLOR_GREEN,string,teamid[playerid]);
}
return 0;
}
stock SendMessageToRAdmins(color,const msg[],tid)
{
for (new i=0; i<MAX_PLAYERS; i++) // i recommend to use foreach(Player,i)
if (IsPlayerConnected(i) && teamid[i]==tid) SendClientMessage(i,color,msg);
}