if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You are not logged in yet.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: (/r)adio [text]");
return 1;
}
if(PlayerInfo[playerid][pRank] >= 1)
{
if(gTeam[playerid] == 2)
{
format(string, sizeof(string), "** %s: %s **", sendername, result);
SendTeamMessage(2, COLOR_LIGHT_YELLOW, string);
format(string, sizeof(string), "(Radio) %s says: %s", sendername, result);
ProxDetector(20.0, giveplayerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 1;
}
else if(gTeam[playerid] == 3)
{
format(string, sizeof(string), "** %s: %s **", sendername, result);
SendTeamMessage(3, COLOR_LIGHT_YELLOW, string);
format(string, sizeof(string), "** %s mutters something on the radio.", sendername);
ProxDetector(30.0, playerid, string,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC);
return 1;
}
else if(gTeam[playerid] == 4)
{
format(string, sizeof(string), "** %s: %s **", sendername, result);
SendTeamMessage(4, COLOR_LIGHT_YELLOW, string);
format(string, sizeof(string), "** %s mutters something on the radio.", sendername);
ProxDetector(30.0, playerid, string,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use that command.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use that command.");
}
}
return 1;
}
Forward and modify ProxDetector, make a ProxDetectorEx function out of It.
In the ProxDetectorEx function, make a check so It does not send the message to the same team, as they can see the radio anyways. |
format(string, sizeof(string), "** %s: %s **", sendername, result); //This two lines is for the Team to see and me
SendTeamMessage(2, COLOR_LIGHT_YELLOW, string);
format(string, sizeof(string), "(Radio) %s says: %s", sendername, result); //This line should be edited so only players around me can see what I'm tryping in the radio
ProxDetector(20.0, giveplayerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
You got it wrong, this got nothing to do with the SendTeamMessage, it should be there but I want the ProxDetector to work like SendTeamMessage just that it will be shown to other players that are near me, and I should not be able to see it, only the SendTeamMessage, understand me now?
|
Yes, I did from your first topic. I hade the exact same problem when I was dumb enough to use a GF edit.
I have the code at my computer, but I'm not at home right now. Do as I said, and replace your Proxdetector code. * forward ProxDetectorEx (Copy & Paste forward ProxDetector(blahblah); and just rename it to ProxDetectorEx) * Copy & Paste the whole ProxDetector function, rename the second one to ProxDetectorEx. * Make a check inside ProxDetectorEx, and If the players around is in the same team It shouldn't send to them. If you don't understand me I don't know how to explain it. |