Sending one message instead of 2
#1

I know the topic name is lame heh..
i have a problem when people are talking in /radio it sends the radio message twice, it sends the message to all people on the radio channel, and everybody around him..
Thats what i want but the player who types the message gets the message twice(the radio and the proxdetector), could i make so he only sees the (radio) chat, and others around him see's the other part, just to avoid being spammed when talking in radio

Code:
  	if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			new wstring[128];
			new faction = PlayerInfo[playerid][pFaction];
			new rank = PlayerInfo[playerid][pRank];
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_WHITE, "[Usage] (/r)adio");
				return 1;
			}
			if(Muted[playerid])
			{
				SendClientMessage(playerid, COLOR_GREY, "[Error] You can not use the radio, You are muted");
				return 1;
			}
			if(PlayerInfo[playerid][pFaction] == 5 || PlayerInfo[playerid][pFaction] == 0)
			{
				 		if(rank == 1)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
						  ProxDetector(20.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
							SendFactionTypeMessage(1, COLOR_LSPD, wstring);
						  FactionChatLog(wstring);
						}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "[Error] Invalid faction");
			}
		}
		return 1;
	}
One more thing! I'm tired of other players spectating me when i am testing, so can i disable people to spectate me, example:
/spec perker
returns and sends a message; Fool.

since the code is based on ID, could it then check the ID's name with some extra stuff ?

Code:
	if(strcmp(cmd, "/spec", true) == 0)
	{
	  new playerid2;
	  tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GREY, "[Usage] /spec [ID] to spectate a player.");
			return 1;
		}
		playerid2 = strval(tmp);
		if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)
		{
		TogglePlayerSpectating(playerid, 1);
		PlayerSpectatePlayer(playerid, playerid2);
		SetPlayerInterior(playerid,GetPlayerInterior(playerid2));
		}
		return 1;
	}
That is my code, please help me
Reply


Messages In This Thread
Sending one message instead of 2 - by Perker12345 - 11.01.2010, 09:42
Re: Sending one message instead of 2 - by [HiC]TheKiller - 11.01.2010, 10:08
Re: Sending one message instead of 2 - by Perker12345 - 11.01.2010, 10:53
Re: Sending one message instead of 2 - by [HiC]TheKiller - 11.01.2010, 10:59
Re: Sending one message instead of 2 - by Perker12345 - 11.01.2010, 12:00

Forum Jump:


Users browsing this thread: 1 Guest(s)