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: Out of bounds (
/showthread.php?tid=470104)
Out of bounds -
Juandawson - 16.10.2013
hey guys, when i compile my script :i get this
Код:
D:\GTA San Andreas\Test\gamemodes\test.pwn(1442) : error 032: array index out of bounds (variable "MainMenuTxtdraw")
Line :
pawn Код:
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[6]);
can anyone help?
Re: Out of bounds -
xVIP3Rx - 16.10.2013
Show us your definition of "MainMenuTxtdraw[6]".
Re: Out of bounds -
Konstantinos - 16.10.2013
It was not declared as a single array. What I meant by that is that you may declared it as 2D array.
pawn Код:
new
Text: MainMenuTxtdraw[ 10 ][ 10 ]
;
and that gives "error 032: array index out of bounds (variable "MainMenuTxtdraw")" error.
So it should be:
pawn Код:
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[6][5]);
That was just an example of what the error is. Change the values depending on your script.
EDIT: Now you showed the code, it should be:
pawn Код:
new
Text: MainMenuTxtdraw[ 7 ]
;
Re: Out of bounds -
Juandawson - 16.10.2013
pawn Код:
public ShowGUI(playerid)
{
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[0]);
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[1]);
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[2]);
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[3]);
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[4]);
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[5]);
TextDrawShowForPlayer(playerid, MainMenuTxtdraw[6]);
}
pawn Код:
MainMenuTxtdraw[6] = TextDrawCreate(283.000000, 58.000000, SERVER_GM_TEXT);
TextDrawBackgroundColor(MainMenuTxtdraw[6], 255);
TextDrawFont(MainMenuTxtdraw[6], 2);
TextDrawLetterSize(MainMenuTxtdraw[6], 0.200000, 1.200001);
TextDrawColor(MainMenuTxtdraw[6], -65281);
TextDrawSetOutline(MainMenuTxtdraw[6], 0);
TextDrawSetProportional(MainMenuTxtdraw[6], 1);
TextDrawSetShadow(MainMenuTxtdraw[6], 1);
P.S i get this errors in all TD