[HELP] Radio question
#1

Hello ya' all.

I got a simple radio command that send a radio message via SendTeamMessage and a ProxDetector message that send a message to players around...

pawn Код:
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;
    }
Now to the question, I want al other players around me to be able to see what I'm typing in the radio, as you can see on the first line I gave it a try, it works but now I can see a double message of what I'm typing, I want the second message to only be viewable to players around.

Thanks
Reply
#2

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.
Reply
#3

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
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.
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?

Example:

pawn Код:
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);
Reply
#4

Quote:
Originally Posted by Fredden1993
Посмотреть сообщение
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.
Reply
#5

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
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.
I know some of what you mean, but if you can send me the code when you get home, I would appreciate it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)