Crash Detect Runtime Error - 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: Crash Detect Runtime Error (
/showthread.php?tid=443734)
Crash Detect Runtime Error -
Tamer - 13.06.2013
Код:
[18:21:44] [debug] Run time error 4: "Array index out of bounds"
[18:21:44] [debug] Accessing element at index 65535 past array upper bound 99
[18:21:44] [debug] AMX backtrace:
[18:21:44] [debug] #0 000676d8 in public OnPlayerDeath (0x00000002, 0x0000ffff, 0x000000ff) from GameMode.amx
[18:21:44] [death] Dominic_Cube died 255
Where to look,I assume OnPlayerDeath... Seems like the problem is while we execute OnPlayerDeath,you notice the last second the guy dies. It seems like reason 255,let me check what does the reason 255 indicate.
Код:
[18:23:42] [debug] Run time error 4: "Array index out of bounds"
[18:23:42] [debug] Accessing element at index 65535 past array upper bound 99
[18:23:42] [debug] AMX backtrace:
[18:23:42] [debug] #0 000676d8 in public OnPlayerDeath (0x00000017, 0x0000ffff, 0x00000036) from GameMode.amx
[18:23:42] [death] ahmedamr died 54
Found another one with reason 54
Edit:
Seems like reason 54 is splat,that was why my OnPlayerDeath not working if player hits the ground etc and dies. How can I make reason 54 work?
*Couldn't find reason 255
Re: Crash Detect Runtime Error -
Vince - 13.06.2013
You are incrementing a value for killerid without checking if killerid is connected. If a player kills himself by falling, drowning, ... then the killerid will be 65535, a.k.a. INVALID_PLAYER_ID.
Re: Crash Detect Runtime Error -
Tamer - 13.06.2013
So I should tie/check the whole callback to if(killerid =! INVALID_PLAYER_ID) then start the callback?
Re: Crash Detect Runtime Error -
Vince - 13.06.2013
That's entirely up to you. Either way it must be checked before you increment the killerid variable.