• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Script: error 018: initialization data exceeds declared size
#1
I am developing an event system that will have some customizations, and I started with the following data structure.

However, when the compiler is giving the following error:?(52) : error 018: initialization data exceeds declared size





Code Pawn - Pastebin.com





I am trying to find the solution, but I have no idea how to solve it.
  Reply
#2
enum eEvents

{

? ? eID,

? ? eName[20],

? ? eCapacity,

? ? bool:eSetHealth,

? ? bool:eSetArmour,

? ? bool:eResetWeapons,

? ? bool:eDeadOnExitVehicle,

? ? bool:eGivePistol

};



new EventConfig[MAX_EVENTS][eEvents] = {

? ? // Corridas

? ? { EVENTID_RUN1, "Rally", 10, true, false, true, true, false },

? ? { EVENTID_RUN2, "Bike Trilha", 10, true, false, true, true, false },

? ? { EVENTID_RUN3, "Barco", 10, true, false, true, true, false },

? ? { EVENTID_RUN4, "Kart", 10, true, false, true, true, false },

? ? { EVENTID_RUN5, "Corrida Maluca", 10, true, false, true, true, false },

? ? { EVENTID_RUN6, "Tratorrida", 10, true, false, true, true, false },

? ? { EVENTID_RUN7, "Moto Cross", 10, true, false, true, true, false },

? ? // ?ltimo Sobrevivente

? ? { EVENTID_SURVIVEL1, "?ltimo Sobrevivente", 10, true, true, true, false, true },

? ? // Funny Games

? ? { EVENTID_FUNNY1, "FallOut", MAX_PLAYERS, true, false, true, false, false },

? ? { EVENTID_FUNNY2, "Color Match", MAX_PLAYERS, true, false, true, false, false },

? ? { EVENTID_FUNNY3, "Hay", MAX_PLAYERS, true, false, true, false, false },

? ? { EVENTID_FUNNY4, "Tesouro", MAX_PLAYERS, false, false, false, false, false },

};





Last item in the list requires no comma, that is how you tell the compiler that that item is the last one in the list.
  Reply
#3
I hadn't realized that. Thanks for the help!
  Reply
#4
That's only true on the old compiler. Trailing commas are very very common in programming and the updated compiler supports them. It's actually a good thing Virsenas noticed that because I wouldn't have - I'm too used to trailing commas being allowed that I wouldn't have seen that code as wrong in any way. Anyway, I suggest you update your compiler:



https://github.com/pawn-lang/compiler/



I also suggest you use an enum for the indexes as well:



https://pastebin.com/VeWhp8U0
  Reply
#5
(2021-03-13, 02:18 PM)Y_Less Wrote: That's only true on the old compiler.? Trailing commas are very very common in programming and the updated compiler supports them.? It's actually a good thing Virsenas noticed that because I wouldn't have - I'm too used to trailing commas being allowed that I wouldn't have seen that code as wrong in any way.? Anyway, I suggest you update your compiler:

https://github.com/pawn-lang/compiler/

I also suggest you use an enum for the indexes as well:

https://pastebin.com/VeWhp8U0

Okay, I'll follow the advice.

I already use this version of the compiler :D
  Reply


Forum Jump: