error 008: must be a constant expression; assumed zero (+REP) [quick one] - 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 008: must be a constant expression; assumed zero (+REP) [quick one] (
/showthread.php?tid=605146)
error 008: must be a constant expression; assumed zero (+REP) [quick one] -
Lirbo - 15.04.2016
the line with the error is new ClanDB[ClanName][ClanInfo];
PHP код:
enum ClanInfo
{
Bank,
Color
}
new ClanName[32];
new ClanDB[ClanName][ClanInfo];
Re: error 008: must be a constant expression; assumed zero (+REP) [quick one] -
introzen - 15.04.2016
As far as I know, you cannot use a string as an array index.
Hence, you will have to assign an ID to every clan name.
PHP код:
#define MAX_CLANS 50
#define CLAN_POLICE 1
#define CLAN_MEDIC 2
enum ClanInfo
{
Bank,
Color
}
new ClanDB[MAX_CLANS][ClanInfo];
Function(){
ClanDB[CLAN_POLICE][Bank] = 1337;
}