[HELP] What is wrong with this?
#1

I have finaly fixed a police radio, but I only have 2 errors left to fix... but I cant figure it out.

Here is the script:

public OnPlayerCommandText(playerid, cmdtext[])

Код:
	if(strcmp(cmdtext , "/radio", true) == 0)
	{
    if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this.");
			{
				if ((strlen(cmdtext) >= 1)&&(strlen(cmdtext) <= 3))
					{
            new string[128];
						new playername[MAX_PLAYER_NAME];
						GetPlayerName(playerid,playername,sizeof(playername));
						format(string,sizeof(string),"*Radio: %s:%s",playername,cmdtext[128]);
						SendCopMessage(COLOR_BLUE, string);
						return 1;
					}
			}
	}
	return 0;
}
On the bottom of my script.

Код:
SendCopMessage(color, text[]) {
  for(new i = 0; i < MAX_PLAYERS; i ++) {
  if(IsPlayerConnected(i)) {
  if(GetPlayerTeam(playerid) != 5)
      SendClientMessage(i, color, text);
      }
    }
  }
}
The errors:

error 017: undefined symbol "playerid"
error 054: unmatched closing brace ("}")

Thanks so mutch!
Reply
#2

Problems are in the function SendCopMessage...
When you did GetPlayerTeam you used playerid instead of i
You used 1 more bracket than you needed to
Reply
#3

Quote:
Originally Posted by OmeRinG
Problems are in the function SendCopMessage...
When you did GetPlayerTeam you used playerid instead of i
You used 1 more bracket than you needed to
Now I have:

Код:
	if(strcmp(cmdtext , "/radio", true) == 0)
	{
    	if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this.");
			{
				if ((strlen(cmdtext) >= 1)&&(strlen(cmdtext) <= 3))
					{
            new string[128];
						new playername[MAX_PLAYER_NAME];
						GetPlayerName(playerid,playername,sizeof(playername));
						format(string,sizeof(string),"Police Radio: %s:%s",playername,cmdtext[128]);
						SendCopMessage(COLOR_BLUE, string);
						return 1;
					}
			}
	}
	return 0;
}
Код:
SendCopMessage(color, text[]) {
	for(new i = 0; i < MAX_PLAYERS; i ++) {
  if(IsPlayerConnected(i)) {
  if(GetPlayerTeam(i) != 5)
      SendClientMessage(i, color, text);
      }
    }
  }
But when I type /radio, it says Unknown Command..., nothing more
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)