SA-MP Forums Archive
error 029: invalid expression, assumed zero - 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 029: invalid expression, assumed zero (/showthread.php?tid=495568)



error 029: invalid expression, assumed zero - Ercha - 17.02.2014

Код:
CMD:changepass(playerid,params[])
{
	new pass[128];
	if(sscanf(params, "s[128]", pass))
	{
		SendClientMessage(playerid,COLOR_RED,"Usage: /changepass <new pass>");
	        return 1;
	}
	if(strlen(pass) < MIN_PASS_LEN || strlen(pass) > MAX_PASS_LEN);
	{
		SendClientMessage(playerid,COLOR_RED,"SERVER: Incorrect password length.");
		return 1;
	}
	new string[128];
        UpdatePlayerPass(playerid, pass);
	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass);
	SendClientMessage(playerid,COLOR_YELLOW,string);
	return 1;
}
Код:
error 029: invalid expression, assumed zero
When i try to compile this, it give's those annoying errors, which i don't know how fix.. tried many times but nothing.


Re: error 029: invalid expression, assumed zero - redneckvideogamer - 17.02.2014

What's the error line?


Re: error 029: invalid expression, assumed zero - Ercha - 17.02.2014

Quote:
Originally Posted by redneckvideogamer
Посмотреть сообщение
What's the error line?
8342
8345
8347


Re: error 029: invalid expression, assumed zero - MartynasK - 17.02.2014

Show the lines...


Re: error 029: invalid expression, assumed zero - redneckvideogamer - 18.02.2014

I feel like I know what it is.

Try replacing this line:

Код:
format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass);
with:

Код:
format(string, sizeof(string),"SERVER: You have successfully changed your password to %s",pass);



Re: error 029: invalid expression, assumed zero - CuervO - 18.02.2014

Код:
if(strlen(pass) < MIN_PASS_LEN || strlen(pass) > MAX_PASS_LEN);
There's your mistake, statement ending in semicolon


Re: error 029: invalid expression, assumed zero - Scaleta - 18.02.2014

Quote:
Originally Posted by CuervO
Посмотреть сообщение
Код:
if(strlen(pass) < MIN_PASS_LEN || strlen(pass) > MAX_PASS_LEN);
There's your mistake, statement ending in semicolon
Hah, luckily it isn't valid. In a language such as Java, you would just wonder why your code wasn't checking conditions correctly.