Set an whole enum array
#1

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;
}
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)