Quote:
Originally Posted by chrism11
i don't believe you can get the size of a enum lol
try
Код:
new myStructure[3] =
{
StructureItem1,
StructureItem2,
StructureItem3
};
if thats not what your talking please show the code where your getting the error so i can understand what your trying to do
|
No, I want to get the number of constants in the enum. In my example there are 3 constants, so sizeof should return 3.
My structure and array using it:
Код:
enum enum_permission
{
PERMISSION_ADMIN,
PERMISSION_MAPPER,
PERMISSION_MODERATOR,
PERMISSION_NPCADMIN,
PERMISSION_SERVERADMIN,
PERMISSION_TELEPORT
}
new permissions[MAX_PLAYERS][enum_permission];
And later I want to loop through the structure items:
Код:
for (new permission = 0; permission < 6; permission++)// TODO: Replace constant number (6) with anything to get size of enum_permission
{
if (permissions[playerid][enum_permission:permission])
{
if (strlen(string))
{
format(string, sizeof(string), "%s ", string);
}
format(string, sizeof(string), "%s%s", string, GetPermissionName(permission));
}
}
Is there really no way to get the size of the structure?