[NOT SOLVED!]Teamchat? - 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: [NOT SOLVED!]Teamchat? (
/showthread.php?tid=90904)
[NOT SOLVED!]Teamchat? -
_Vortex - 11.08.2009
Hello, I made a tdm server, (with gteams) and i need help with making it so theres a teamchat so if someone puts something like "@" before talking, then it sends it to their whole team..
How do I do this?
Thanks a bunch
Re: Teamchat? -
agusfn20 - 11.08.2009
Add this to your GM
pawn Код:
public OnPlayerText(playerid,text[])
{
if(text[0] == '@')
{
new string[128]; GetPlayerName(playerid, string, sizeof(string));
format(string, sizeof(string), "*Equip: %s: %s", string, text[1]);
printf("%s", string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, GetPlayerColor(playerid), string);
}
return 0;
}
return 1;
}
Re: Teamchat? -
_Vortex - 11.08.2009
Thanks, but how do I make it show the stuff that the person is typing as white? its kinda hard to read it in all one color.
Re: [NOT SOLVED!]Teamchat? -
agusfn20 - 11.08.2009
That code sends player message to all players with the same team as him, and the message is sended with the players colour. Ex: "@ hi all", if i am colour red the message will be red and will be sent to all players of my team.
Sorry my bad english
Re: [NOT SOLVED!]Teamchat? -
_Vortex - 11.08.2009
Quote:
Originally Posted by agusfn20
That code sends player message to all players with the same team as him, and the message is sended with the players colour. Ex: "@ hi all", if i am colour red the message will be red and will be sent to all players of my team.
Sorry my bad english 
|
Yes, I know, but I want the text of what the player is saying to be white..
Example:
"
TEAM: NAME: Blablabla"
Re: [NOT SOLVED!]Teamchat? -
coole210 - 11.08.2009
pawn Код:
public OnPlayerText(playerid,text[])
{
if(text[0] == '@')
{
new string[128]; GetPlayerName(playerid, string, sizeof(string));
format(string, sizeof(string), "gTeamnamehere %s: %s", string, text[1]); // Specify which gTeams you need this for.
printf("%s", string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, COLOR_WHITE, string); // Changes color to white, not what color player is.
}
return 0;
}
return 1;
}
Re: [NOT SOLVED!]Teamchat? -
Joe Staff - 11.08.2009
What you're asking for is SendPlayerMessageToPlayer, instead of SendClientMessage.