SA-MP Forums Archive
Help error: initialization data exceeds declared size - 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: Help error: initialization data exceeds declared size (/showthread.php?tid=657027)



Help error: initialization data exceeds declared size - Libbyphay - 30.07.2018

PHP код:
enum enum_Itens
{
    
item_Id,
     
item_Type,
      
item_Model,
     
item_Name[24],
    
item_Limit,
    
bool:item_Candrop,
    
bool:item_CanUse,
    
item_Information[200]
}
new 
Itens[][enum_Itens] =
{
  
//ID    Type                     Model       Name                   Limit   CanDrop  CanUse  Information
    
{0,   ITEM_TYPE_NORMAL,        19382,      "Emepty",              "0",    false,   false,  "N/A"}, // Line 63
    
{1,   ITEM_TYPE_NORMAL,        11738,      "Med Kit",             "1",    true,    true,   "~>~ Bla bla."}, // Line 64
    
{2,   ITEM_TYPE_WEAPON,        348,        "Desert Eagle",        "1",    true,    true,   "~>~ Bla bla 3"// Line 65
}; 
Код:
./Source/Players/Inventory.pwn(63) : warning 228: length of initialler exceeds size of the enum field
./Source/Players/Inventory.pwn(63) : error 018: initialization data exceeds declared size
Help me


Re: Help error: initialization data exceeds declared size - Libbyphay - 30.07.2018

Quote:
Originally Posted by ******
Посмотреть сообщение
Why are the limits strings?
I think item_Information[200] ?


Re: Help error: initialization data exceeds declared size - Rufio - 30.07.2018

Quote:
Originally Posted by Libbyphay
Посмотреть сообщение
I think item_Information[200] ?
No. You have item_limits as a variable which isn't an array. You can't use string for item_limits so
"1" in your limits should just be 1


Re: Help error: initialization data exceeds declared size - Libbyphay - 30.07.2018

Quote:
Originally Posted by Rufio
Посмотреть сообщение
No. You have item_limits as a variable which isn't an array. You can't use string for item_limits so
"1" in your limits should just be 1
PHP код:
new Itens[][enum_Itens] = 

  
//ID    Type                     Model       Name                   Limit   CanDrop  CanUse  Information 
    
{0,   ITEM_TYPE_NORMAL,        19382,      "Emepty",              0,    false,   false,  "N/A"}, // Line 63 
    
{1,   ITEM_TYPE_NORMAL,        11738,      "Med Kit",             1,    true,    true,   "~>~ Bla bla."}, // Line 64 
    
{2,   ITEM_TYPE_WEAPON,        348,        "Desert Eagle",        1,    true,    true,   "~>~ Bla bla 3"// Line 65 
}; 
OMG thanks you it working +rep for you.