'constant expression; assumed zero' Any ideas?
#1

Im attempting to make a copy of the mod garage menu's, im using a simple enum with a multi dimentional array, i keep getting an error any help appriciated.

PHP код:
    enum cat {
        
text[40]
    }
    new 
cat:gShopItems[] = {
        {
"Paint Jobs"},
        {
"Colours"},
        {
"Exhausts"},
        {
"Front Bumper"},
        {
"Rear Bumper"},
        {
"Roof"},
        {
"Spoilers"},
        {
"Side Skirts"},
        {
"Wheels"},
        {
"Car Stereo"},
        {
"Hydraulics"},
        {
"Nitro"}
    }; 
I have not included entire array, simply the first bit that has the error, but will if needed.

{"Paint Jobs"}, gets me the following error "error 008: must be a constant expression; assumed zero"

Any help apriciated,
Thanks, Grimrandomer
Reply
#2

pawn Код:
new gShopItems[][cat] = {
//...
Reply
#3

That fixed it, Thanks for the reply
Reply
#4

I now want to go for Sub Catagories, But getting a similar error:

PHP код:

enum subcat 
{
    
itemID,
    
text[40]
}
enum cat {
    
text[40],
    
subcat:item[2]
}
    new 
gShopItems[][cat] = {
        {
"Paint Jobs",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Colours",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Exhausts",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Front Bumper",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Rear Bumper",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Roof",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Spoilers",
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Side Skirts",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Wheels",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Car Stereo",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Hydraulics",{
            {
1,"A"},
            {
2,"B"}
        }},
        {
"Nitro",{
            {
1,"A"},
            {
2,"B"}
        }}
    }; 
{1,"A"} gives me the error
Reply
#5

I guess this is the only workaround
pawn Код:
enum subcat
    {
        itemID,
        text[40]
    }
    enum cat
    {
        name[40],
        sub1[subcat],
        sub2[subcat]
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)