AmX Backtrace.. Confused - 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: AmX Backtrace.. Confused (
/showthread.php?tid=619620)
AmX Backtrace.. Confused -
Clora - 20.10.2016
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;
}
Re: AmX Backtrace.. Confused -
SickAttack - 20.10.2016
As you can see
playerid is equal to 161576932, max players can be up to 999.
Re: AmX Backtrace.. Confused -
Clora - 20.10.2016
So i should use
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
before preforming the next code?
Re: AmX Backtrace.. Confused -
Vince - 20.10.2016
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.
Re: AmX Backtrace.. Confused -
Konstantinos - 20.10.2016
I'm pretty sure the format specifier is not
d or
i in
mysql_tquery.
Re: AmX Backtrace.. Confused -
Clora - 20.10.2016
empty code
Re: AmX Backtrace.. Confused -
Clora - 20.10.2016
Thank you guys for the input, I've fixed the problem.