SA-MP Forums Archive
Pawno Error... I can't seem to find the issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Pawno Error... I can't seem to find the issue (/showthread.php?tid=644838)



Pawno Error... I can't seem to find the issue - crpJohn - 15.11.2017

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]);



Re: Pawno Error... I can't seem to find the issue - Kane - 15.11.2017

Show the code that's above that line.


Re: Pawno Error... I can't seem to find the issue - crpJohn - 15.11.2017

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


Re: Pawno Error... I can't seem to find the issue - Ritzy2K - 15.11.2017

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


Re: Pawno Error... I can't seem to find the issue - crpJohn - 15.11.2017

Код:
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?


Re: Pawno Error... I can't seem to find the issue - Kane - 15.11.2017

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.


Re: Pawno Error... I can't seem to find the issue - BiosMarcel - 15.11.2017

The error lies here:

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

There is a comma and a brace too much.


Re: Pawno Error... I can't seem to find the issue - crpJohn - 15.11.2017

Код:
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.


Re: Pawno Error... I can't seem to find the issue - Dayrion - 15.11.2017

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;




Re: Pawno Error... I can't seem to find the issue - crpJohn - 15.11.2017

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.