SA-MP Forums Archive
error 008: must be a constant 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 008: must be a constant expression; assumed zero (/showthread.php?tid=243601)



error 008: must be a constant expression; assumed zero - Typhome - 23.03.2011

Omfg...


Re: error 008: must be a constant expression; assumed zero - Gamer_Z - 23.03.2011

You CANNOT declare array sizes with dynamic variables. You must count all the data and make the array big enough or if you don't know how big it is just use '[]'


Re: error 008: must be a constant expression; assumed zero - Typhome - 23.03.2011

Omfg...


Re: error 008: must be a constant expression; assumed zero - 6d - 23.03.2011

pawn Код:
new CData[APPROXCARCOUNT][cInfo];
That's how you should declare it.


Re: error 008: must be a constant expression; assumed zero - Typhome - 24.03.2011

Omfg...


Re: error 008: must be a constant expression; assumed zero - Calgon - 24.03.2011

56 and MAX_VEHICLES are both constants, 'carcount' is a variable which isn't a constant. If you declare 'carcount' as a global constant/macro, that should work.


Re: error 008: must be a constant expression; assumed zero - Typhome - 24.03.2011

#define somecount carcount

56+somecount? Or what then?


Re: error 008: must be a constant expression; assumed zero - Calgon - 24.03.2011

No, just set a constant size, i.e: 256.


Re: error 008: must be a constant expression; assumed zero - Typhome - 24.03.2011

Omfg...


Re: error 008: must be a constant expression; assumed zero - Hiddos - 24.03.2011

Quote:
Originally Posted by Typhome
Посмотреть сообщение
new CData[256][cInfo];?

Hell no, because carcount is variable(changing).

When some bought car, then it will count carcount +1.
Well you can't change that later so just use MAX_VEHICLES


Re: error 008: must be a constant expression; assumed zero - Calgon - 24.03.2011

Yes, but the problem is you CANNOT specify a DYNAMIC size, therefore you MUST use a constant. The error message even tells you that!


Re: error 008: must be a constant expression; assumed zero - Typhome - 24.03.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
Yes, but the problem is you CANNOT specify a DYNAMIC size, therefore you MUST use a constant. The error message even tells you that!
Now i did understand the problem, thanks.