SA-MP Forums Archive
Warning: more initiallers than enum fields - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Warning: more initiallers than enum fields (/showthread.php?tid=525022)



Warning: more initiallers than enum fields - KesaSport - 09.07.2014

pawn Код:
enum istr
{
    INV_NAME[24],// error 001: expected token: "}", but found "("
    Float:INV_WEIGHT,
    INV_MODEL,
    Float:INV_MODEL_ZOOM,
    Float:INV_MODEL_ROOTX,
    Float:INV_MODEL_ROOTY,
    Float:INV_MODEL_ROOTZ
};
new const Inventory[][istr] =
{
    {"nnnnn",                   0.0,    0,          0.0,        0.0,        0.0,        0.0},//warning 228: length of initialler exceeds size of the enum field  ++++ warning 227: more initiallers than enum fields
    {"GPS navigacija",          0.32,   18875,      1.0,        -90.0,      0.0,        180.0},
    {"N. liemene",              3.25,   1242,       1.0,        0.0,        0.0,        0.0},
    {"Pasas",                   0.01,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas1",             0.35,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas2",             0.35,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas3",             0.35,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas4",             0.35,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas5",             0.35,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas6",             0.35,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas7",             0.35,   1581,       1.0,        0.0,        0.0,        210.0},
    {"Somedaikas8",             0.35,   1581,       1.0,        0.0,        0.0,        210.0}
};
Errors and warnings note in code. Any ideas?


Re : Warning: more initiallers than enum fields - S4t3K - 09.07.2014

Nothing on my side



I think it cames from you, but somewhere else in your code.


Re: Warning: more initiallers than enum fields - Konstantinos - 09.07.2014

Show us where Inventory array is used because that's where the mistake is.

@S4t3K: Even if there was a mistake in the initialization of it, it wouldn't show the errors/warnings as you never use it anywhere.


Re : Warning: more initiallers than enum fields - S4t3K - 09.07.2014

@Konstantinos : That's why I tried to use the array using this code :

PHP код:

public OnFilterScriptInit()
{
    
printf("%s"Inventory[0][INV_NAME]);
    
printf("%d"Inventory[0][INV_WEIGHT]);
    
printf("%d"Inventory[0][INV_MODEL]);
    
printf("%f"Inventory[0][INV_MODEL_ZOOM]);
    
printf("%f"Inventory[0][INV_MODEL_ROOTX]);
    
printf("%f"Inventory[0][INV_MODEL_ROOTY]);
    
printf("%f"Inventory[0][INV_MODEL_ROOTZ]);
    return 
1;

But the only change that I noticed was that the warning : unused symbol was removed.
As you've stated, the problem cames from the way he uses the array.


Respuesta: Warning: more initiallers than enum fields - Zume - 09.07.2014




Re: Warning: more initiallers than enum fields - KesaSport - 10.07.2014

I fixed all erors, but where I using variable INV_NAME I'll give warning 213: tag mismatch


Re: Warning: more initiallers than enum fields - KesaSport - 10.07.2014

I fixed all erors, but where I using variable INV_NAME I'll give warning 213: tag mismatch