debug crashdetect
#1

how to fix these errors detected by crashdetect?
please helpme

PHP код:
[07:00:22] [debugRun time error 4"Array index out of bounds"
[07:00:22] [debug]  Accessing element at index 250 past array upper bound 249
[07:00:22] [debugAMX backtrace:
[
07:00:22] [debug#0 0038b9a4 in public SSCANF_OnGameModeInit () from Lko.amx
[07:00:22] [debug#1 0001ac80 in ?? () Lko.amx
[07:00:22] [debug#2 0000557c in public ScriptInit_OnGameModeInit () from Lko.amx
[07:00:22] [debug#3 00001194 in public OnGameModeInit () from Lko.amx 
Reply
#2

Show your OnGameModeInit.
Reply
#3

I have found the error, the error code is this, what's wrong with it?

PHP код:
    for(new 01000i++)
    {
        
CreateDynamic3DTextLabel("Battery Ment"0x00BFFFFFALocations[i][LocX], ALocations[i][LocY], ALocations[i][LocZ], 30.0);
    } 
Reply
#4

I don't think that's the code caused it. It says the size of the array is 250 and in the loop, it's 1000 which is way too far. You're looking for an array with size 250 and probably in a loop.

Nevertheless, you can find the exact line caused the run time error by using debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info
Re-compile your scripts and run the server. If it prints information again with the [debug] prefix, post your new server log.
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I don't think that's the code caused it. It says the size of the array is 250 and in the loop, it's 1000 which is way too far. You're looking for an array with size 250 and probably in a loop.

Nevertheless, you can find the exact line caused the run time error by using debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info
Re-compile your scripts and run the server. If it prints information again with the [debug] prefix, post your new server log.
So I took this code from callback and the error is gone, I believe it's him, right?
Reply
#6

One way to find out. Change the code to:
pawn Код:
for(new i = 0; i < sizeof (ALocations); i++)
{
    CreateDynamic3DTextLabel("Battery Ment", 0x00BFFFFF, ALocations[i][LocX], ALocations[i][LocY], ALocations[i][LocZ], 30.0);
}
and that won't go out of bounds.
Reply
#7

Ok, nice! Thanks brother.

Now you can help me in this? Please?

PHP код:
[08:15:52] [debugRun time error 4"Array index out of bounds"
[08:15:52] [debug]  Accessing element at index 300 past array upper bound 299
[08:15:52] [debugAMX backtrace:
[
08:15:52] [debug#0 003a4e64 in ?? (0x00000000) from Lko.amx
[08:15:52] [debug#1 0038f0a4 in public Streamer_OnPlayerConnect (0x00000000) from Lko.amx
[08:15:52] [debug#2 00020898 in public SSCANF_OnPlayerConnect (0x00000000) from Lko.amx
[08:15:52] [debug#3 0001ad54 in ?? (0x00000000) from Lko.amx
[08:15:52] [debug#4 000058fc in public OnPlayerConnect (0x00000000) from Lko.amx 
Reply
#8

The only known is OnPlayerConnect callback and the run time error.

Use debug info to find which line caused it because it might be a function inside OnPlayerConnect and that's way for difficult to find it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)