2D Array in enum? - 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: 2D Array in enum? (
/showthread.php?tid=553683)
2D Array in enum? -
Facerafter - 30.12.2014
pawn Код:
enum fInfo
{
fLeader[MAX_PLAYER_NAME],
fMembers,
fRank[10][24], // Line 325
fDeptName[4][24],
fDeptTag[4][12]
}
new FactionInfo[MAX_FACTIONS][fInfo];
I found out that this causes an error
Quote:
error 001: expected token: "}", but found "["
|
How to fix it or another way without having fRank 10 times.
AW: 2D Array in enum? -
Nero_3D - 31.12.2014
an enum is just a list of constants therefor it can only be 1d
the savest way would be to exclude these variables like
pawn Код:
enum fInfo
{
fLeader[MAX_PLAYER_NAME],
fMembers
}
new FactionInfo[MAX_FACTIONS][fInfo];
new FractionRank[MAX_FACTIONS][10][24];
enum fDept
{
fDeptName[24],
fDeptTag[12]
}
new FractionDept[MAX_FACTIONS][4][fDept];
the other way would be to use maths (not recommended because the compiler / server wont case errors if you are out of bounds)