Radio Chat problem!! Will rep+
#1

Hello everyone,

Well I'm working on a gamemode, but having problems with the radio.
When you talk in radio chat, it sends the chat to everyone, not only to your team.
I will rep+ if you can help me.
This is my code:

PHP код:
CMD:r(playerid,params[])
{
if(
isnull(params)) return SendClientMessage(playeridCOLOR_RED"USAGE: /r [text] to talk in team radio");
new 
Name[MAX_PLAYER_NAME]; GetPlayerName(playeridNamesizeof(Name));
new 
string[128];
format(stringsizeof(string), "[Team Radio]%s[%d]: %s",Name,playeridparams[0]);
printf("%s"string);
for(new 
0MAX_PLAYERSi++)
{
if(
IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(iCOLOR_LGREENstring);
}
return 
1;

Reply
#2

pawn Код:
CMD:r(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /r [text] to talk in team radio");
new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "[Team Radio]%s[%d]: %s",Name,playerid, params[0]);
printf("%s", string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid])
{
SendClientMessage(i, COLOR_LGREEN, string);
}
}
return 1;
}
Reply
#3

This won't fix it you know, putting brackets is not the solution dude, anyone help me?
Reply
#4

Anyone please help? The problem I'm having is that everyone can see all /radio chats..
Reply
#5

Looks like it would work.

Are you sure everyone on the server isn't on the same team?
Reply
#6

Probably if this doesn't work, then your gTeam system is not well coded
Reply
#7

Yes I'm absolutely sure we're in different teams, tried many times to fix, but failed.
Well at first I added new gTeam[MAX_PLAYERS] then I added this code..
Any idea on why it's not working properly?
Will rep+, thank you.
Reply
#8

Here:

Код:
if(IsPlayerConnected(i) && gTeam[playerid] == gTeam[i] || gTeam[i] == gTeam[playerid] )
Make sure to asign gTeam in onPlayerConnect or SetPlayerTeam, if all people have the same team the message will send to everyone.
Reply
#9

Could you please tell me what you ment by: Assign gTeam in OnPlayerConnect or SetPlayerTeam?
I'm a new scripter, so If you can kindly give me the codes, would be great.
Reply
#10

Anyone help me please? I need to fix this fast
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)