initializer problem
#1

How do I initialize an array inside an array in an enum?
Код:
enum ClassInfo
{
	Name[128],
	Description[128],
	ScoreRequired,
	Weapon[3], //must initialize
	WeaponAmmo[3] //must initialze
};
new cInfo[][ClassInfo] =
{
	{"Assault", "The most basic class of all the classes.", 0, 34, 34, 34, 100, 100, 100} // error
	{"Assault", "The most basic class of all the classes.", 0, 34, 35, 36, 100, 100, 100}
	{"Assault", "The most basic class of all the classes.", 0, 37, 38, 39, 100, 100, 100}
};
Код:
rtdm.pwn(63) : warning 227: more initiallers than enum fields
rtdm.pwn(63) : warning 227: more initiallers than enum fields
rtdm.pwn(63) : warning 227: more initiallers than enum fields
rtdm.pwn(63) : warning 227: more initiallers than enum fields
rtdm.pwn(63) : error 018: initialization data exceeds declared size
rtdm.pwn(66) : error 010: invalid function or declaration
I get why the errors are like that, but I really do not know how to solve my problem.
Reply
#2

Weapon[3] is an array within so you have to use '{' brackets.

pawn Код:
{"Assault", "The most basic class of all the classes.", 0, {34, 34, 34}, {100, 100, 100}}
Reply
#3

You need to wrap them inbetween { }

pawn Код:
new cInfo[][ClassInfo] =
{
    {"Assault", "The most basic class of all the classes.", 0, {34, 34, 34}, {100, 100, 100}},
    {"Assault", "The most basic class of all the classes.", 0, {34, 35, 36}, {100, 100, 100}},
    {"Assault", "The most basic class of all the classes.", 0, {37, 38, 39}, {100, 100, 100}}
};
and you also forgot the , on the first two.
Reply
#4

Thank you very much guys.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)