Crashdetect Array Index out of bounds.
#1

thank you...
Reply
#2

Load crashdetect plugin and compile with debug info. Re-compile your scripts, start the server and let that diaog appear again. In case it prints anything, post the server log.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Load crashdetect plugin and compile with debug info. Re-compile your scripts, start the server and let that diaog appear again. In case it prints anything, post the server log.
Код:
[20:38:16] [debug] Run time error 4: "Array index out of bounds"
[20:38:16] [debug]  Accessing element at negative index -1
[20:38:16] [debug] AMX backtrace:
[20:38:16] [debug] #0 00013c04 in public OnDialogResponse (playerid=0, dialogid=16501, response=1, listitem=-1, inputtext[]=@0x00030988 "") at gamemode.pwn:605
That's what it did output


-- I think I might know what's the prob... gotta create temp varriable, since the textbox doesn't carry "listitem" over
Reply
#4

listitem is -1. What's the line 605?

Before using listitem inside [] in the array HelpMeListItem, you should check if the value is not out of bounds.
pawn Код:
if (0 <= listitem < 25)
{
    // you can use listitem in HelpMeListItem with safety here
}
else return // error..
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
listitem is -1. What's the line 605?

Before using listitem inside [] in the array HelpMeListItem, you should check if the value is not out of bounds.
pawn Код:
if (0 <= listitem < 25)
{
    // you can use listitem in HelpMeListItem with safety here
}
I managed to fix it by storing listitem from PREVIOUS dialog into an array, so it can be carried over to DIALOG_STYLE_MSGBOX response...
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)