[debug] Accessing element at index 30 past array upper bound 29
#1

EDIT: I solved it changing MAX_FURNITURE to MAX_HOUSE_FURNITURE !!


Код:
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at index 30 past array upper bound 29
It gives the error on this loop, why its bad?


PHP код:
    for (new i = 0; i != MAX_FURNITURE; i ++) {
        
ListedFurniture[playerid][i] = -1;
    }
    return 
1;
} 
Or maybe becouse the EasyDialog include?

PHP код:
[debug] #0 001ba28c in public dialog_ListedFurniture (playerid=0, response=0, listitem=0, inputtext[]=@0x0088ba84 "Bathroom 12 (4.55 meters)") at C:\Reality Roleplay\gamemodes\roleplay.pwn:25906
[debug] #1 native CallLocalFunction () [004743b0] from samp-server.exe
[debug] #2 00003360 in public OnDialogResponse (playerid=0, dialogid=32700, response=0, listitem=0, inputtext[]=@0x0088ba1c "Bathroom 12 (4.55 meters)") at C:\Reality Roleplay\pawno\include\easyDialog.inc:131 
PHP код:
        if ((s_Public == -1) || (CallLocalFunction("OnDialogPerformed", "dsdd", playerid, string[7], response, funcidx(string) != -1)))
        {
             
CallLocalFunction(string, "ddds", playerid, response, listitem, (!inputtext[0]) ? ("\1") : (inputtext)); // HERE TE LINE 131
        
} 
Reply
#2

Okay so lemme tell you what exactly went wrong here, it's not the include its your loop.

https://sampforum.blast.hk/showthread.php?tid=654036

^ This explains the error you got.

ListedFurniture[playerid][i]

i was > the second array.

The only reason it was fixed when you:

Quote:

EDIT: I solved it changing MAX_FURNITURE to MAX_HOUSE_FURNITURE !!

Is because MAX_HOUSE_FURNITURE was smaller than MAX_FURNITURE so 'i' didn't go beyond the limits of the array size.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)