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



error 018: initialization data exceeds declared size - DStreet - 13.10.2013

I don't understand why im getting theses errors for the following code
Код:
new Float:GroveRandomSpawns[3][3] = {
	{2488.4663,-1685.7067,13.5092},
	{2505.3184,-1656.6368,13.5938},
	{2505.5000,-1682.6000,13.5469},
};

new Float:BallasRandomSpawns[3][3] = {
	{2012.7721,-1107.1403,26.2032},
	{2004.1615,-1121.5463,26.7073},
	{1998.9436,-1142.8440,25.5315},
};
What do I have to fix?


Re: error 018: initialization data exceeds declared size - DanishHaq - 13.10.2013

Try and remove the comma of the last float in the { and } brackets, as follows:

pawn Код:
new Float:Name[3][3] = {
        {...},
        {...},
        {...} // there is no comma here
};
So:

pawn Код:
new Float:GroveRandomSpawns[3][3] = {
    {2488.4663,-1685.7067,13.5092},
    {2505.3184,-1656.6368,13.5938},
    {2505.5000,-1682.6000,13.5469}
};

new Float:BallasRandomSpawns[3][3] = {
    {2012.7721,-1107.1403,26.2032},
    {2004.1615,-1121.5463,26.7073},
    {1998.9436,-1142.8440,25.5315}
};



Re: error 018: initialization data exceeds declared size - DStreet - 13.10.2013

Wow thanks silly me for not knowing


Re: error 018: initialization data exceeds declared size - Pottus - 13.10.2013

Can I give you a suggestion try doing this.

pawn Код:
enum XYZ { xPos, yPos, zPos }

stock const Float:BallasRandomSpawns[][XYZ] = {
    {2012.7721,-1107.1403,26.2032},
    {2004.1615,-1121.5463,26.7073},
    {1998.9436,-1142.8440,25.5315}
};
That will help out a lot in the long run.