cops and agents team chat ?? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: cops and agents team chat ?? (
/showthread.php?tid=123275)
cops and agents team chat ?? -
RobShakur - 25.01.2010
create 2 team chats i dont understand ?
agents and cops
new playerid_team = GetPlayerTeam(playerid);
for (new i = 0; i < MAX_PLAYERS; i++)
if (IsPlayerConnected(i) && GetPlayerTeam(i) == playerid_team)
SendPlayerMessageToPlayer(i, playerid, text);
return 0; //block the normal chat
}
Re: cops and agents team chat ?? -
mansonh - 25.01.2010
What don't you understand about it?
Its a part of the messaging system, when someone types a command it determines what team they are and only sends a message to people who are also in that team.
Re: cops and agents team chat ?? -
[dN]Eagle - 25.01.2010
Код:
public OnPlayerText(playerid, text[])
{
new string[256];
new playername[MAX_PLAYER_NAME];
if(text[0] == '!' && text[1] != 0)
{
GetPlayerName( playerid, playername, MAX_PLAYER_NAME );
format( string, 128, "[Team] %s: %s", playername, text[1] );
for(new i = 0; i < MAX_PLAYERS; i++ )
{
if( IsPlayerConnected(i) && gTeam[playerid] == gTeam[i] )
SendClientMessage( i, YOUR_COLOR, string );
}
return 0;
}
return 1;
}
This only works if you have
Код:
static gTeam[MAX_PLAYERS];
You can change "!" to your desired command for team chat.