PDA

View Full Version : How to make a Group/Team Chat?


HydraX
12/04/2009, 02:27 AM
I was looking into some admin scripts but seems like it doesnt work, anyway

i want to know How to make a Group/Team Chat?

Like Defenders is green

they have to press say "#" to chat with there team

so it will be like

[DEFENDER] Hunter: My Message Here...

And Attacker

[ATTACKER] Bob: My Message Here....

RobertGraham
12/04/2009, 02:30 AM
You mean something like:

/d message = [DEFENDER]Player: Message

and

/a message = [ATTACKER]Player: Message

HydraX
12/04/2009, 02:34 AM
yea soemthing like that

and if also

if the player is DEFENDER

they press

/a

it should say "Your Not in that Team"

RobertGraham
12/04/2009, 03:11 AM
You should probably post in this topic:
http://forum.sa-mp.com/index.php?topic=94387.0

Dylan_Madigan69
30/01/2012, 11:41 PM
ive been wondering for a long time, could you please PM me or atleast post here if you find out how to make this chat please?

jamesbond007
30/01/2012, 11:52 PM
look in other simple gamemodes for examples or ******...

its easy just do something like..


static gTeam[MAX_PLAYERS];
#define attacker 1
#define defender 2

// when player types command:
if(gTeam[playerid]==attacker)
{
//loop the message thought all players in attacker's team
}
else return 0;//or sendmessage Your Not in that Team

DonWade
31/01/2012, 01:20 AM
Maybe this http://forum.sa-mp.com/showthread.php?t=274514
its not team messages , but group , could be usefull :)

Twinki1993
01/02/2012, 02:08 PM
Ay mate. Well here is what I use

public OnPlayerText(playerid, text[])
{
if(text[0] == "!" || text[0] == "@")
{
new name[MAX_PLAYER_NAME], msg[128];
GetPlayerName(playerid, name, sizeof(name));

format(msg, sizeof(msg), "[Team Chat] %s[%d]: %s", name, playerid, text[1]);

for(new i; i<=MAX_PLAYERS; i++)
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
{
SendClientMessage(i, TEAMCOLOR, msg);
}
}
return 0;
}
}

This works perfectly fine with me. Just change "@" to your desired letter for example #. This way it will say

[Team-Chat] MyName: Text

Of course. If you wish to change your team message you should change

format(msg, sizeof(msg), "[Team Chat] %s[%d]: %s", name, playerid, text[1]);

to desired text.
For example:
format(msg, sizeof(msg), "[My Team] %s[%s]: %s", name, playerid, text[1]);

I hope it will help you

+rep