SA-MP Forums Archive
Set an whole enum array - 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: Set an whole enum array (/showthread.php?tid=245761)



Set an whole enum array - Manuel1948 - 01.04.2011

Hey People!

I wanted to set an whole array with enum to one value, but i don't know how to.
The enum in the eample is little, don't worry about it.
It should be like:

Код:
enum fInfo
{
	admin,
 	dialog,
 	login,
};
new bool:FreezeInfo[MAX_PLAYERS][fInfo];

for(new i=0;i<sizeof(fInfo);i++)
{
    FreezeInfo[playerid][i]=false;
}



Re: Set an whole enum array - s0nic - 02.04.2011

Lets see..well first of all there should be no comma after the login slot in the array
Secondly, As far as i know..It wouldn't work with that loop as its attempting to use integers in which the array slots being used are defined differently. But like i said there might be a way that i don't know of but i don't think it works that way..
I tried a different way shown here(Note: I tested it this way because its the only way i can on this computer, but its not the best way either):
pawn Код:
new bool:FreezeInfo[MAX_PLAYERS][3];
main()
{
    for(new i=0;i<sizeof(FreezeInfo);i++)
    {
        FreezeInfo[1][i] = 1;
        printf("TRUE  %d | %d", i, FreezeInfo[1][i]);
        FreezeInfo[1][i] = 0;
        printf("FALSE %d | %d", i, FreezeInfo[1][i]);
    }
}
Outcome:
Код:
 TRUE  0 | 1
 FALSE 0 | 0
 TRUE  1 | 1
 FALSE 1 | 0
 TRUE  2 | 1
 FALSE 2 | 0
I'm sorry if i can't help you get the result you wanted..hope you find out how