Crash detect , Debug. rep+ - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Crash detect , Debug. rep+ (
/showthread.php?tid=574089)
Crash detect , Debug. rep+ -
MarwanCartman - 13.05.2015
Код:
[16:32:11] [kill] Player1 killed Felixen MP5
[16:32:11] [chat] [Player1 ]: HACKS
[16:32:15] [debug] Run time error 4: "Array index out of bounds"
[16:32:15] [debug] Accessing element at index 65535 past array upper bound 499
[16:32:15] [debug] AMX backtrace:
[16:32:15] [debug] #0 00032a60 in ?? (39, 65535, 53) from GM.amx
[16:32:15] [debug] #1 00006044 in public OnPlayerDeath (39, 65535, 53) from GM.amx
[16:32:15] [death] Player3 died 53
Re: Crash detect , Debug. rep+ -
Sithis - 13.05.2015
Past upper bound 499 indicates an operation on an array with MAX_PLAYERS is causing this. Make sure to check for INVALID_PLAYER_ID whenever needed.
Re: Crash detect , Debug. rep+ -
MarwanCartman - 13.05.2015
Sorry i didnt quite get it, can you be precise ?
Re: Crash detect , Debug. rep+ -
Sithis - 13.05.2015
[16:32:15] [debug] Accessing element at index 65535 past array upper bound 499
[16:32:15] [debug] AMX backtrace:
[16:32:15] [debug] #0 00032a60 in ?? (39,
65535, 53) from GM.amx
[16:32:15] [debug] #1 00006044 in public OnPlayerDeath (39,
65535, 53) from GM.amx
OnPlayerDeath was called with the parameters you see above. The killerid is 65535 (which is an INVALID_PLAYER_ID, because I guess your MAX_PLAYERS is 500).
In this scenario, this simply means there is no killer. However, your code assumes there is one because some method calls do not check if the killerid is invalid, such as:
PHP код:
pInfo[killerid][credits] += 1;
That code is not checked for an INVALID_PLAYER_ID and as such, you are accessing an array element above the upper limit of MAX_PLAYERS (which I assume is 500 in this case).
Re: Crash detect , Debug. rep+ -
MarwanCartman - 13.05.2015
Quote:
Originally Posted by Sithis
[16:32:15] [debug] Accessing element at index 65535 past array upper bound 499
[16:32:15] [debug] AMX backtrace:
[16:32:15] [debug] #0 00032a60 in ?? (39, 65535, 53) from GM.amx
[16:32:15] [debug] #1 00006044 in public OnPlayerDeath (39, 65535, 53) from GM.amx
OnPlayerDeath was called with the parameters you see above. The killerid is 65535 (which is an INVALID_PLAYER_ID, because I guess your MAX_PLAYERS is 500).
In this scenario, this simply means there is no killer. However, your code assumes there is one because some method calls do not check if the killerid is invalid, such as:
PHP код:
pInfo[killerid][credits] += 1;
That code is not checked for an INVALID_PLAYER_ID and as such, you are accessing an array element above the upper limit of MAX_PLAYERS (which I assume is 500 in this case).
|
Thank you. Problem Fixed, Rep+ed