[HELP] Getting crazy...
#1

If you have readed my other topic, I had probpems with the cop radio... I fixed it by adding...

Код:
if(gTeam[playerid] == TEAM_LVPD)
Anyway.. now I have to change some cmds in the script to that TEAM_LVPD, it worked on all cmds, but not this one:

Код:
	if (strcmp("/onduty", cmdtext, true, 7) == 0)
	{
	     if(gTeam[playerid] == TEAM_LVPD)
	     new str[256], pname[256];
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "Officer %s Is now on duty!", pname, cmdtext[7]);
		SendClientMessageToAll(COLOR_BLUE, str);
		return 1;
	}
The errors/warnings I get is:

Код:
declaration of a local variable must appear in a compound block
undefined symbol "str"
expression has no effect
expected token: ";", but found "]"
too many error messages on one line

4 Errors
All errors if from the same line "701" that is:

Код:
new str[256], pname[256];
What is the problem, all this errors/warnings on the same line?!

NOTE: If I delete the full cmd, the errors just moves down to the other cmd /offduty...

Reply
#2

//At the top of the screen
pawn Код:
new gTeam[MAX_PLAYERS];
#define TEAM_LVPD 1
//OnPlayerCommandText:
pawn Код:
if (strcmp("/onduty", cmdtext, true, 7) == 0)
{
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == TEAM_LVPD)
{
new str[256], pname[256];
GetPlayerName(playerid, pname, 256);
format(str, 256, "Officer %s Is now on duty!", pname, cmdtext[7]);
SendClientMessageToAll(COLOR_BLUE, str);
}
}
}
return 1;
}
Reply
#3

Quote:
Originally Posted by bpeterson
//At the top of the screen
pawn Код:
new gTeam[MAX_PLAYERS];
#define TEAM_LVPD 1
//OnPlayerCommandText:
pawn Код:
if (strcmp("/onduty", cmdtext, true, 7) == 0)
{
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == TEAM_LVPD)
{
new str[256], pname[256];
GetPlayerName(playerid, pname, 256);

format(str, 256, "Officer %s Is now on duty!", pname, cmdtext[7]);
SendClientMessageToAll(COLOR_BLUE, str);
}
}
}
return 1;
}
It gives exactly the same errors/warnings...
Reply
#4

Here are some more info...

On the Top:

Код:
#define TEAM_LVPD 1
new gTeam [MAX_PLAYERS];
public OnPlayerRequestClass(playerid, classid)

Код:
			}
		}
		case 16:
		{
      GameTextForPlayer(playerid, "Police Officers", 3000, 3);
      {
                  gTeam[playerid] = TEAM_LVPD;
		  	     SetPlayerInterior(playerid, 3);
				SetPlayerPos(playerid, 236.8276,157.2697,1003.0234);
				SetPlayerCameraPos(playerid, 240.0176,154.8471,1003.0234);
				SetPlayerFacingAngle(playerid, 231.0738);
				SetPlayerCameraLookAt(playerid, 236.8276,157.2697,1003.0234);
				SetPlayerColor(playerid, COLOR_BLUE);
				ApplyAnimation(playerid,"PLAYIDLES","TIME",4.1,1,1,1,1,1);
			}
		}
public OnPlayerCommandText(playerid, cmdtext[])

Код:
	if (strcmp("/onduty", cmdtext, true, 7) == 0)
	{
		if(gTeam[i] == TEAM_LVPD)
		new str[256], pname[256];
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "Officer %s Is now on duty!", pname, cmdtext[7]);
		SendClientMessageToAll(COLOR_BLUE, str);
		return 1;
	}
On the bottom of my script...

Код:
SendCopMessage(color, text[]) {
  for(new i = 0; i < MAX_PLAYERS; i ++) {
  if(IsPlayerConnected(i)) {
  if (gTeam[i] == TEAM_LVPD) {
      SendClientMessage(i, color, text);
      }
    }
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)