Pawno Error... I can't seem to find the issue
#1

I compiled my CnR script I'm working on, and it gave me two errors on one line, it shows the following:

Errors that shows for LINE 297
Код:
error 001: expected token: ";", but found "]"
error 001: expected token: ",", but found "["
LINE 297:
Код:
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
Reply
#2

Show the code that's above that line.
Reply
#3

Код:
public OnPlayerUpdate(playerid)
{
	SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
^ Line above SetPlayerScore
Reply
#4

You need to show us more lines around this line, That line of code is completely normal and shouldn't give out any errors.
Reply
#5

Код:
public OnPlayerUpdate(playerid)
{
	SetPlayerScore(playerid, PlayerInfo[playerid],[pScore]);
	}
	if(gTeam[playerid] == LSPD)
	{
	    SetPlayerColor(playerid, COLOR_LIGHTBLUE);
	}
	    else if(gTeam[playerid] == Criminals)
	{
	    SetPlayerColor(playerid, COLOR_GREEN);
	}
	 else
	 {
	    SetPlayerColor(playerid, COLOR_WHITE);
	    }
	return 1;
}
Whole code beginning to end from OnPlayerUpdate, I really see nothing wrong... Unless I'm missing something?
Reply
#6

Highlighted in red unless you did that by accident when you posted the code.

Код:
public OnPlayerUpdate(playerid)
{
	SetPlayerScore(playerid, PlayerInfo[playerid],[pScore]);
	}
	if(gTeam[playerid] == LSPD)
	{
	    SetPlayerColor(playerid, COLOR_LIGHTBLUE);
	}
	    else if(gTeam[playerid] == Criminals)
	{
	    SetPlayerColor(playerid, COLOR_GREEN);
	}
	 else
	 {
	    SetPlayerColor(playerid, COLOR_WHITE);
	    }
	return 1;
}
On another note, I don't recommend using OnPlayerUpdate for this. Seems useless. Set their score and color when they're changed instead of every second.
Reply
#7

The error lies here:

PHP код:
SetPlayerScore(playeridPlayerInfo[playerid],[pScore]);

There is a comma and a brace too much.
Reply
#8

Код:
public OnPlayerUpdate(playerid)
{
	SetPlayerScore(playerid, PlayerInfo[playerid],[pScore]);
	
	if(gTeam[playerid] == LSPD)
	{
	    SetPlayerColor(playerid, COLOR_LIGHTBLUE);
	}
	    else if(gTeam[playerid] == Criminals)
	{
	    SetPlayerColor(playerid, COLOR_GREEN);
	}
	 else
	 {
	    SetPlayerColor(playerid, COLOR_WHITE);
	    }
	return 1;
}
So I removed the } and yet it still stands
Код:
error 029: invalid expression, assumed zero
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
But with extra errors.
Reply
#9

PHP код:
public OnPlayerUpdate(playerid)
{
    
SetPlayerScore(playeridPlayerInfo[playerid][pScore]);
    switch(
gTeam[playerid])
    {
        case 
LSPDSetPlayerColor(playeridCOLOR_LIGHTBLUE);
        case 
CriminalsSetPlayerColor(playeridCOLOR_GREEN);
        default: 
SetPlayerColor(playeridCOLOR_WHITE);
    }
    return 
1;

Reply
#10

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
PHP код:
public OnPlayerUpdate(playerid)
{
    
SetPlayerScore(playeridPlayerInfo[playerid][pScore]);
    switch(
gTeam[playerid])
    {
        case 
LSPDSetPlayerColor(playeridCOLOR_LIGHTBLUE);
        case 
CriminalsSetPlayerColor(playeridCOLOR_GREEN);
        default: 
SetPlayerColor(playeridCOLOR_WHITE);
    }
    return 
1;

Gives me the same errors.

EDIT: It has to do with this line only ...
Код:
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
But nothing is wrong with it.

EDIT #2: Fixed the problem, a code was misplaced.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)