SA-MP Forums Archive
Syntax error - 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: Syntax error (/showthread.php?tid=398994)



Syntax error - DaRoderick - 12.12.2012

Hi,

I'm getting this error
Код:
error 076: syntax error in the expression, or invalid function call
for this line
pawn Код:
format(string,sizeof(string),"%s%s(%d): %s%s",Colour[playerid][pNameCol],PlayerName,playerid,Colour[playerid][pChat],text[0]);
Where did I make my mistake..?


Re: Syntax error - Infinity90 - 12.12.2012

Show me the value of text


Re: Syntax error - DaRoderick - 12.12.2012

pawn Код:
public OnPlayerText (playerid,text[])



Re: Syntax error - Infinity90 - 12.12.2012

pawn Код:
format(string,sizeof(string),"%s%s(%d): %s%s",Colour[playerid][pNameCol],PlayerName,playerid,Colour[playerid][pChat],text);
Try that, I don't really use that function as ZCMD / YCMD's are better


Re: Syntax error - DaRoderick - 12.12.2012

Still the same error. I do use ZCMD by the way..


Re: Syntax error - Infinity90 - 12.12.2012

Have you tried...
pawn Код:
new colour = GetPlayerColor(playerid);
format(string,sizeof(string),"%s(%d): %s%s",PlayerName,playerid,Colour[playerid][pChat],text);
SendClientMessageToAll(colour,string);



Re: Syntax error - DaRoderick - 12.12.2012

Colour is already in the script

pawn Код:
new Colour[MAX_PLAYERS][pInfo];



Re: Syntax error - Infinity90 - 12.12.2012

pawn Код:
new colourzZ69 = GetPlayerColor(playerid);
format(string,sizeof(string),"%s(%d): %s%s",PlayerName,playerid,Colour[playerid][pChat],text);
SendClientMessageToAll(colourzZ69,string);



Re: Syntax error - DaRoderick - 12.12.2012

Still the same error..


Re: Syntax error - Threshold - 12.12.2012

What values are given to Colour[playerid][pChat] ?? If they are hex values, you cannot format them as strings, so it will return a syntax error. Which is why players cannot usually use SendClientMessage(GetPlayerColour(playerid),... as GetPlayerColour returns a hex value.