SA-MP Forums Archive
Why do I get this 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: Why do I get this error? (/showthread.php?tid=455173)



Why do I get this error? - Sascha - 31.07.2013

Hi,
any of you got an idea why I get this error?

Код:
error 008: must be a constant expression; assumed zero
error 029: invalid expression, assumed zero
error 017: undefined symbol "n"
fatal error 107: too many error messages on one line
all on this line:
pawn Код:
new SpList[mysql_num_rows()], n=0;



Re: Why do I get this error? - Alternative112 - 31.07.2013

You cannot set array/string sizes dynamically, you must explicitly define them.

pawn Код:
new SpList[MAX_SPS], n=0;
mysql_num_rows() is a value that would only be obtainable after the script was compiled, which pawn does not allow - it must know the size of all strings/arrays prior to compilation.


Re: Why do I get this error? - Sascha - 01.08.2013

sad, already guessed that....
I hoped there was a way to make it more efficient, but I guess it's not possible -.-

thanks