SA-MP Forums Archive
Enums - 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: Enums (/showthread.php?tid=502820)



Enums - DLR - 26.03.2014

Why can't I use arrays in enums? Such as...

pawn Код:
enum FacInfo
{
    fSName[255],
    fType,
    fLName[255],
    fColour[32],
    fRank[12][64],
    fDivisonS[8][64],
    fDivisonL[8][64],
};
I'm trying to script dynamic factions and want to be able to edit the names of ranks and divisions. So when I make a call in my script, such as the following, it doesn't work.

pawn Код:
format(string, sizeof(string), "Faction%dRank1=%s\n",f,FactionInfo[f][fRank[1]]); fwrite(hFile, string);



Re: Enums - RenSoprano - 26.03.2014

pawn Код:
enum FacInfo
{
    fSName[255],
    fType,
    fLName[255],
    fColour[32],
    fRank[12][64],
    fDivisonS[8][64],
    fDivisonL[8][64],
};

new fRank[MAX_FACTIONS][12][64];
new fDivisonS[MAX_FACTIONS][8][64];
new fDivisonL[MAX_FACTIONS][8][64];
You can do it like that

Код:
format(string, sizeof(string), "Faction%dRank1=%s\n",f,fRank[f][0]); fwrite(hFile, string);



Re: Enums - DLR - 26.03.2014

I'll give that a go, thanks.

Do I still need the fRank, fDivisionL, fDivisionS in the enum?


Re: Enums - iZN - 26.03.2014

Quote:
Originally Posted by DLR
Посмотреть сообщение
I'll give that a go, thanks.

Do I still need the fRank, fDivisionL, fDivisionS in the enum?
No you don't.


Re: Enums - DLR - 26.03.2014

Seems to have compiled nicely now.