AmX Backtrace.. Confused
#1

Hello, I've been trying all day to debug this down and i just cannot seem to get my head on what's the problem, maybe some of you lads can help me out.

Код:
[23:00:47] [debug] Run time error 4: "Array index out of bounds"
[23:00:47] [debug]  Accessing element at index 161576932 past array upper bound 999
[23:00:47] [debug] AMX backtrace:
[23:00:47] [debug] #0 0009d7fc in public OnPlayerCreateAccount (playerid=161576932) at 15295
Here is my code for OnPlayerCreateAccount,
Код:
public OnPlayerCreateAccount(playerid)
{
	PlayerInfo[playerid][pDatabaseID] = cache_insert_id(dbHandle); <- LINE 15295
	ShowLoginDialog(playerid);
	return 1;
}
Reply
#2

As you can see playerid is equal to 161576932, max players can be up to 999.
Reply
#3

So i should use
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
before preforming the next code?
Reply
#4

How exactly do you think that will solve anything? It's obviously some kind of bug. You will have to show the event that first calls OnPlayerCreateAccount (probably the query) because the faulty playerid originates there. Experience tells me that it's possibly a buffer overflow.
Reply
#5

I'm pretty sure the format specifier is not d or i in mysql_tquery.
Reply
#6

empty code
Reply
#7

Thank you guys for the input, I've fixed the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)