29.01.2013, 19:04
Hiya guys.. In game I have team chat setup so that when you do this..
#Hey guys, come to Grove street!
It displays like this if you are on grove
[Team Chat]Tyrone: Hey guys, come to Grove street!
---
This is all well and good, but for some reason ALL the players can see this chat lol and it's no good!
---
Here is my code..
public OnPlayerText(playerid,text[])
{
if(text[0] == '#')
{
new string[128]; GetPlayerName(playerid, string, sizeof(string));
format(string, sizeof(string), "[Team Radio] %s: %s", string, text[1]);
printf("%s", string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, GetPlayerColor(playerid), string);
}
return 0;
}
return 1;
}
Any ideas? +Rep for anyone helping out
#Hey guys, come to Grove street!
It displays like this if you are on grove
[Team Chat]Tyrone: Hey guys, come to Grove street!
---
This is all well and good, but for some reason ALL the players can see this chat lol and it's no good!
---
Here is my code..
public OnPlayerText(playerid,text[])
{
if(text[0] == '#')
{
new string[128]; GetPlayerName(playerid, string, sizeof(string));
format(string, sizeof(string), "[Team Radio] %s: %s", string, text[1]);
printf("%s", string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, GetPlayerColor(playerid), string);
}
return 0;
}
return 1;
}
Any ideas? +Rep for anyone helping out