error 052: multi-dimensional arrays must be fully initialized -
LocMax - 04.09.2014
Getting that error on this line:
pawn Код:
new ItemName[MAX_ITEMS][11] = {"Wood", "Stone", "Steel", "Gun powder", "Plastic", "Flint", "Rubber", "Tin", "Cloth", "Skin", "Meat", "Fish", "Aspirin", "Antibiotic", "Flask", "Alcohol"};
My first time to use such arrays, usually I used stock which would return name so may someone tell me what's wrong?
Re: error 052: multi-dimensional arrays must be fully initialized -
Fred1993 - 04.09.2014
show me the MAX_ITEMS define
Re: error 052: multi-dimensional arrays must be fully initialized -
LocMax - 04.09.2014
Re: error 052: multi-dimensional arrays must be fully initialized -
biker122 - 04.09.2014
Maybe try this?
pawn Код:
new ItemName[MAX_ITEMS][] = {
{"Wood"},
{"Stone"},
{"Steel"},
{"Gun powder"},
{"Plastic"},
{"Flint"},
{"Rubber"},
{"Tin"},
{"Cloth"},
{"Skin"},
{"Meat"},
{"Fish"},
{"Aspirin"},
{"Antibiotic"},
{"Flask"},
{"Alcohol"}
};
Re: error 052: multi-dimensional arrays must be fully initialized -
Fred1993 - 04.09.2014
ok so basically you are defining the array but not using storing the values in it
a short example with enum:
PHP код:
enum itemInfo { // enums used for the items
iname[256]
};
PHP код:
new ItemName[][itemInfo] = { // you left the items unlimited as you can see i haven't enter any value in []
{"Wood"},
{"Stone"},
{"Steel"}
};
here i have entered 3 rows with only 1 column , which was iname(itemname) under iteminfo enum
where you are trying to use array for 18 rows and 11 columns
Must be somthing like
PHP код:
new ItemName[MAX_ITEMS][11] = {
{0,1,2,3,4,5,6,7,8,9,10}, // row 1
{0,1,2,3,4,5,6,7,8,9,10}, // row 2
{0,1,2,3,4,5,6,7,8,9,10}, // row 3
.
.
.
{0,1,2,3,4,5,6,7,8,9,10} // row n
};
Re: error 052: multi-dimensional arrays must be fully initialized -
Fred1993 - 04.09.2014
Quote:
Originally Posted by biker122
Maybe try this?
pawn Код:
new ItemName[MAX_ITEMS][] = { {"Wood"}, {"Stone"}, {"Steel"}, {"Gun powder"}, {"Plastic"}, {"Flint"}, {"Rubber"}, {"Tin"}, {"Cloth"}, {"Skin"}, {"Meat"}, {"Fish"}, {"Aspirin"}, {"Antibiotic"}, {"Flask"}, {"Alcohol"} };
|
As this guy showed you the perfect code, but still there's something wrong with it
you have defined 18 values in MAX_Items, and this code is useing 16..
you will face error
Re: error 052: multi-dimensional arrays must be fully initialized -
biker122 - 04.09.2014
I don't know what and how, I just tried to compile his given code in my script and I didn't recieve any warnings/errors.
And yeah, I just noticed that out, Fred1993!
Re: error 052: multi-dimensional arrays must be fully initialized -
LocMax - 04.09.2014
11 was supposed to be string size for it
Gun powder has 10 letters along with antibiotic so I made size for it 11 as bigger isn't needed yet
Re: error 052: multi-dimensional arrays must be fully initialized -
Fred1993 - 04.09.2014
Quote:
Originally Posted by LocMax
11 was supposed to be string size for it
|
If you want to add string size, use the enum method i explained. that will help.
just add MAX_ITEMS in []
Example:
PHP код:
enum itemInfo { // enums used for the items
iname[256]
};
new ItemName[MAX_ITEMS][itemInfo] = {
{"Wood"},
{"Stone"},
{"Steel"} //add your items name here
};
Re: error 052: multi-dimensional arrays must be fully initialized -
LocMax - 04.09.2014
Not working