SA-MP Forums Archive
Problem With arrays and variables - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem With arrays and variables (/showthread.php?tid=103261)



Problem With arrays and variables - [HLF]Southclaw - 19.10.2009

Hi i know i have posted a lot recently asking questions, but I could do with a pointer with this, I get an error with this code:
Код:
error 049: invalid line continuation
error 052: multi-dimensional arrays must be fully initialized
Код:
new RankWeaponsSet1[8][6] =
{
//sidearm - prime - secon - sdamo - pramo - secamo\\
	{1,  	1, 	1, 	1,  	1,  	1}, <<<<< Error 49
	{22, 	29, 	4,	17*3, 	30*3, 	1}, 
	{22, 	29, 	4, 	17*4, 	30*4, 	1}, 
	{22, 	30, 	28, 	17*5, 	30*3, 	100*2}, 
	{24, 	30, 	18,	17*3, 	30*4, 	3},   
	{24, 	31, 	18, 	17*4, 	50*2, 	5},      
	{24, 	31, 	16, 	17*5, 	50*3, 	3},      
	{24, 	31, 	16, 	17*6, 	50*4, 	5}      
}; <<<<<<<<<<<<Error 52
I think im doing something wrong with the ';' and ',' it wil be simple but i've tried a lot!

thanks for any replies


Re: Problem With arrays and variables - Y_Less - 19.10.2009

This problem stems from a little known feature of the compiler relating to line continuations:

pawn Код:
#define A \
    27
That is a valid define because the "\" means "continued on next line". In your code you end the comment with "\\", which tries to tell the compiler to continue the comment on the next line, but you can't do that with comments, hence the first error. The second is likely just a result of the first error (whenever you get a lot of errors ALWAYS fix the first one and try recompile - it's often the case that the others are caused by the first). Also, this is covered in pawn-lang.pdf had you bothered to look there.


Re: Problem With arrays and variables - [HLF]Southclaw - 19.10.2009

I knew it would be simple! I always have the simplest of errors that I can't fix! lol I must look like an idiot!