SA-MP Forums Archive
error 076: syntax error in the expression, or invalid function call - 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: error 076: syntax error in the expression, or invalid function call (/showthread.php?tid=526524)



error 076: syntax error in the expression, or invalid function call - Strummer - 18.07.2014

I'm getting the error on my /stats. Wonder what's happening.

Код:
CMD:stats(playerid,params[])
{
	new string[128];
 	format(string,sizeof(string),"[Ime i prezime: %i] [Spol: %i] [Dob: %i] [Novac: %i][PayDay: %i] [Respekti: %i] [Level: %i]",PlayerName,PlayerInfo[playerid][pSex],PlayerInfo[playerid][pAge],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pPaytime],PlayerInfo[playerid][pRespekti],GetPlayerScore(playerid)); 
 	SendClientMessage(playerid,COLOR_LIGHTBLUE,string); //Ispisuje poruku u COLOR_LIGHTBLUE boji
 	return 1;
}



Re : error 076: syntax error in the expression, or invalid function call - S4t3K - 18.07.2014

PlayerName is supposed to be an array isn't it ?

But you use "%i" to call it. Use "%s" instead.


Re: error 076: syntax error in the expression, or invalid function call - Strummer - 18.07.2014

Oh, right. How about the rest of them, because I still get the error?


Re: error 076: syntax error in the expression, or invalid function call - TLN - 18.07.2014

I guess you forgot to get the player name?
pawn Код:
CMD:stats(playerid,params[])
{
    new string[128], PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "[Ime i prezime: %s] [Spol: %i] [Dob: %i] [Novac: %i][PayDay: %i] [Respekti: %i] [Level: %i]",PlayerName,PlayerInfo[playerid][pSex],PlayerInfo[playerid][pAge],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pPaytime],PlayerInfo[playerid][pRespekti],GetPlayerScore(playerid));
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    return 1;
}



Re: error 076: syntax error in the expression, or invalid function call - Strummer - 18.07.2014

Oh, how silly of me. Thanks, I appreciate your time


Re: error 076: syntax error in the expression, or invalid function call - TLN - 18.07.2014

No problem.


Re: error 076: syntax error in the expression, or invalid function call - Strummer - 18.07.2014

Btw. does anyone know how to change Gender: 0, to Gender: Male?

Since I have DEFINE MALE 0, DEFINE FEMALE 1 xD


Re: error 076: syntax error in the expression, or invalid function call - Don_Cage - 18.07.2014

i use this to show name of gender
pawn Код:
new atext[20];
        if(PlayerInfo[targetid][pSex] == 1) { atext = "Male"; }
        else if(PlayerInfo[targetid][pSex] == 2) { atext = "Female"; }
this is under my public "showstats" and later in the public where it tells the gender i just do atext


Re: error 076: syntax error in the expression, or invalid function call - Strummer - 18.07.2014

Thaanks!