Out of bounds
#1

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?
Reply
#2

Show us your definition of "MainMenuTxtdraw[6]".
Reply
#3

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 ]
;
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)