Team Chat Problem!!! - 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)
+--- Thread: Team Chat Problem!!! (
/showthread.php?tid=352013)
Team Chat Problem!!! -
iOmar - 18.06.2012
pawn Код:
public OnPlayerText(playerid, text[])
{
new strName[MAX_PLAYER_NAME], strOut[129];
GetPlayerName(playerid, strName, sizeof(strName));
if(text[0] == ',') // he used ' ! ' before text in chat box ( change as you wish )
{
new string[129];
strmid(string, text, 1, strlen(text), 129);
if(gTeam[playerid] == TEAM_PAKISTAN || gTeam[playerid] == TEAM_GERMANY || gTeam[playerid] == TEAM_USA || gTeam[playerid] == TEAM_RUSSIA || gTeam[playerid] == TEAM_INDIA)
{
format(strOut, 129, "[Team Radio] %s: %s", strName, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(gTeam[i] == gTeam[playerid]) // change this if you're not using gTeam
SendClientMessage(i, 0x00FF00FF, strOut);
}
}
return 0; // prevent the message to be sent on global chat
}
return 1;
}
I did this for team chat! But every one seeing chat. I mean i want only that team member can see. but every team member can see. Can u help me??
Re: Team Chat Problem!!! -
Avi57 - 18.06.2012
Hope it will Help You !
Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == ',') // : can be changed to whatever symbol u wanna use for player to enable the teamchat.
{
new string[128]; GetPlayerName(playerid, string, sizeof(string)); // Making the new's
format(string, sizeof(string), "[Team Radio] %s: %s", string, text[1]); // Formatted the message
printf("%s", string); // Printed it BOTH ingame + the server log
for(new i = 0; i < MAX_PLAYERS; i++) // Getting the player team and color, required for formatting the msg.
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, GetPlayerColor(playerid), string);
}
return 0;
}