Radio problem, proxdetector
#1

Hi some guy helped me a longtime ago with fixing so the sender only receives the message once and people around him will see it, but now it sends to ALL on the whole server.
Код:
  	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)
			{
				 		if(rank == 1)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 2)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank2],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 3)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank3],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 4)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank4],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 5)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank5],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 6)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank6],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 7)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank7],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 8)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank8],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 9)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank9],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
				 		else if(rank == 10)
						{
						  format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank10],GetPlayerNameEx(playerid),result);
						  FactionChatLog(wstring);
						}
						SendFactionMessage(5, COLOR_LSPD, wstring);
						printf("%s", wstring);
						for(new i; i<MAX_PLAYERS; i++)
						{
						  if(IsPlayerConnected(i))
						  {
						    if(i != playerid)
						    {
						      ProxDetector(20.0, i, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
						    }
						  }
						}
						return 1;
			}
Its the
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(i != playerid)
{
ProxDetector(20.0, i, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_ FADE4,COLOR_FADE5);
Thats the problem, could anybody help me?
Reply


Messages In This Thread
Radio problem, proxdetector - by Perker12345 - 28.01.2010, 20:23
Re: Radio problem, proxdetector - by Joe Staff - 28.01.2010, 20:52
Re: Radio problem, proxdetector - by Perker12345 - 29.01.2010, 06:06

Forum Jump:


Users browsing this thread: 1 Guest(s)