SA-MP Forums Archive
error 032: array index out of bounds - 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 032: array index out of bounds (/showthread.php?tid=449080)



error 032: array index out of bounds - WuPoR - 07.07.2013

Hello,

error:

pawn Код:
error 032: array index out of bounds (variable "Kanalas")
Line:

pawn Код:
Kanalas[ 12 ] = "{D4F20C}Paљtininkų kanalas";
CODE:

pawn Код:
Kanalas[ 0 ] = "{D4F20C}Policijos departamento kanalas";
    Kanalas[ 1 ] = "{D4F20C}Mechanikų kanalas";
    Kanalas[ 2 ] = "{D4F20C}Tulpinių kanalas";
    Kanalas[ 3 ] = "{D4F20C}Brigados kanalas";
    Kanalas[ 4 ] = "{D4F20C}Armijos kanalas";
    Kanalas[ 5 ] = "{D4F20C}Pagr. Medicinos universiteto kanalas";
    Kanalas[ 6 ] = "{D4F20C}Valytojų kanalas";
    Kanalas[ 7 ] = "{D4F20C}Kontrobandos kanalas";
    Kanalas[ 8 ] = "{D4F20C}Picerijos kanalas";
    Kanalas[ 9 ] = "{D4F20C}„Taksita“ kanalas";
    Kanalas[ 10 ] = "{D4F20C}Gelbėtojų kanalas";
    Kanalas[ 11 ] = "{D4F20C}Fūristų kanalas";
    Kanalas[ 12 ] = "{D4F20C}Paљtininkų kanalas";
and
pawn Код:
new     Kanalas             [ MAX_KANALAI ][ 50 ],
please help :/


Re: error 032: array index out of bounds - Mystique - 07.07.2013

What is the MAX_KANALAI defined as?


Re: error 032: array index out of bounds - WuPoR - 07.07.2013

#define MAX_KANALAI 12

#define MAX_KANALAI 13

works !


Re: error 032: array index out of bounds - Mystique - 07.07.2013

I can explain it to you. When you create a variable with cells you can only use a number lower than the defined one. So the reason you got the error was because you defined MAX_KANALAI as the same amount of cells.