SA-MP Forums Archive
Run time error 4 - 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: Run time error 4 (/showthread.php?tid=677158)



Run time error 4 - Yukie - 02.07.2020

I always got this error in my server console
Code:
[22:05:28] [debug] Parameter count corrections:
[22:05:28] [debug]
[22:05:28] [debug] The 1st mangled argments (e.g. `<1073741823 arguments>`) below should read `<1 arguments>`
[22:05:28] [debug]
[22:05:28] [debug] Run time error 4: "Array index out of bounds"
[22:05:28] [debug]  Attempted to read/write array element at index 60 in array of size 50
[22:05:28] [debug] AMX backtrace:
[22:05:28] [debug] #0 003dd368 in public _y_utils_OnPlayerConnect (60) in roleplay.amx
[22:05:28] [debug] #1 00016738 in public SSCANF_OnPlayerConnect (60) in roleplay.amx
[22:05:28] [debug] #2 00008a64 in public MP_OPC (60) in roleplay.amx
[22:05:28] [debug] #3 native CallLocalFunction () in samp03svr
[22:05:28] [debug] #4 00006650 in ?? (60) in roleplay.amx
[22:05:28] [debug] #5 00025cc4 in public OnPlayerConnect (60) in roleplay.amx
I dont know how to fix it

here's my onplayerconnect codes
its quite long thats why I put in pastebin
https://pastebin.com/FaxLDbUz

Thanks in advance


Re: Run time error 4 - Kwarde - 02.07.2020

Runtime error 4: Array index out of bounds.

It means it tries to get data from an array from an index that does not exist. It literally says that:
Code:
[22:05:28] [debug] Run time error 4: "Array index out of bounds"
[22:05:28] [debug]  Attempted to read/write array element at index 60 in array of size 50
One of your arrays has a size of 50 cells, but it attempts to access index 60.
pawn Code:
new myArray[50];
myArray[60] = 1;



Re: Run time error 4 - ShadowMortar - 02.07.2020

1) Download crashdetect.dll or crashdetect.so.
2) Edit pawn.cfg, add "-d3", or use #pragma option -d3 on top of the script, then compile it.
3) Run server.exe, when it breaks, you will see the EXACT line where the error has occurred.
4) Profit.


Re: Run time error 4 - Yukie - 02.07.2020

Quote:
Originally Posted by ShadowMortar
View Post
1) Download crashdetect.dll or crashdetect.so.
2) Edit pawn.cfg, add "-d3", or use #pragma option -d3 on top of the script, then compile it.
3) Run server.exe, when it breaks, you will see the EXACT line where the error has occurred.
4) Profit.
I already fixed it using -d3 method.. thanks