[HELP]Radio Question
#1

Hello,

I'm trying to figure out, when someone uses a radio, the other players around that players should be able to see what the player says in the radio, with ProxDetector.

I just got it to work, but the problem is, the player with the radio can see the ProxDetector message, he should only be able to see the SendRadioMessage.

Here is the Command:

Код:
	if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			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(gTeam[playerid] == 10)
			{
			  if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else
				{
					format(string, sizeof(string), "** %s: %s **", sendername, result);
				}
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				SendRadioMessage(10, COLOR_LIGHT_YELLOW, string);
				return 1;
		  }
			else if(gTeam[playerid] == 11)
			{
			  if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else
				{
					format(string, sizeof(string), "** %s: %s **", sendername, result);
				}
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				SendRadioMessage(11, COLOR_LIGHT_YELLOW, string);
				return 1;
			}
			else if(gTeam[playerid] == 12)
			{
			  if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else
				{
					format(string, sizeof(string), "** %s: %s **", sendername, result);
				}
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				SendRadioMessage(12, COLOR_LIGHT_YELLOW, string);
				return 1;
			}
			else if(gTeam[playerid] == 13)
			{
			  if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** %s: %s **", sendername, result); }
				else
				{
					format(string, sizeof(string), "** %s: %s **", sendername, result);
				}
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				SendRadioMessage(13, COLOR_LIGHT_YELLOW, string);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "	You are not part of the Law Enforcement.");
				return 1;
			}
		}
		return 1;
	}
Thanks, if you dont understand what I mean, just give me the word.
Reply
#2

who should see the prox msgs then? is the proxdetector a func in your mode can i see that 2
Reply
#3

Quote:
Originally Posted by (SF)Noobanatior
who should see the prox msgs then? is the proxdetector a func in your mode can i see that 2
The ProxDetector should be used to show the players around what the ddue with the radio says in it, and SendRadioMessage should be used to only show the radio message for the dude with the radio.

What I'm trying to do is, hide the ProxDetector message for the dude with the radio, he should only be abe to see the SendRadioMessage
Reply
#4

can i see the proxdetector code? does the other lpayers see the prox msgs?
Reply
#5

Quote:
Originally Posted by (SF)Noobanatior
can i see the proxdetector code? does the other lpayers see the prox msgs?
Yepp, they do, here is the new radio code to one of my teams:

Код:
					format(string, sizeof(string), "** %s: %s **", sendername, result);
					ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					SendRadioMessage(10, COLOR_LIGHT_YELLOW, string);
					return 1;
Reply
#6

LimitGlobalChatRadius(100.0);
in OnGameModeInit

or

pawn Код:
OnPlayerText(playerid,text[]){
if(!strcmp(text,"",false,1)){
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(text,140,"%s sussurra: %s",pname,text[1]);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=0;i<MAX_PLAYERS;i++){
if(IsPlayerInRangeOfPoint(i,8.0,x,y,z)){//DISTANCE
SendClientMessage(i,0xFFFFFFAA,text);
}
}
return false;
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)