Problem
#1

This error is in server logs

Код:
[21:09:02] [debug] Run time error 4: "Array index out of bounds"
[21:09:02] [debug]  Accessing element at index 65535 past array upper bound 499
[21:09:02] [debug] AMX backtrace:
[21:09:02] [debug] #0 001195b8 in public OnPlayerTakeDamage (0x00000000, 0x0000ffff, 0x409e6667, 0x00000036) from Beta.amx
and

Код:
[12:42:17] [debug] Run time error 4: "Array index out of bounds"
[12:42:17] [debug]  Accessing element at negative index -1
[12:42:17] [debug] AMX backtrace:
[12:42:17] [debug] #0 00141904 in ?? (0xffffffff) from Beta.amx
[12:42:17] [debug] #1 0014183c in ?? (0xffffffff, 0xffffffff) from Beta.amx
[12:42:17] [debug] #2 00141624 in ?? (0x00000004, 0x00000002) from Beta.amx
[12:42:17] [debug] #3 00047000 in public Itter_OnPlayerDisconnect (0x00000004, 0x00000001) from Beta.amx
[12:42:17] [debug] #4 0000be54 in public SSCANF_OnPlayerDisconnect (0x00000004, 0x00000001) from Beta.amx
[12:42:17] [debug] #5 00004894 in public Streamer_OnPlayerDisconnect (0x00000004, 0x00000001) from Beta.amx
[12:42:17] [debug] #6 native CallLocalFunction () [080d2bb0] from samp99160
[12:42:17] [debug] #7 00003fa8 in public OnPlayerDisconnect (0x00000004, 0x00000001) from Beta.amx
Then after some minutes it got closed!
Reply
#2

show the code of the beta.pwn
Reply
#3

Beta.pwn is all the gamemode
This is my OnPlayerTakeDamage , btw i use 0.3x
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new string[128];
    if(gTeam[issuerid] == TEAM_COP || gTeam[issuerid] == TEAM_ARMYAIR || gTeam[playerid] == TEAM_ARMYLAND || gTeam[issuerid] == TEAM_CIA || gTeam[issuerid] == TEAM_SWAT)
    {
        if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMYAIR && gTeam[playerid] != TEAM_ARMYLAND && gTeam[playerid] != TEAM_CIA && gTeam[playerid] != TEAM_SWAT && IsTazed[playerid] == 0)
        {
            if(weaponid == 23)
            {
                format(string,sizeof(string),"Police officer %s(%d) has tazed %s(%d).",PlayerName(issuerid),issuerid,PlayerName(playerid),playerid);
                SendClientMessageToAll(COLOR_DODGERBLUE,string);
                GameTextForPlayer(playerid, "~b~TAZED~n~~w~FOR ~y~3~w~SECONDS", 3000, 5);
                TogglePlayerControllable(playerid,0);
                ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.299999, 1, 1, 1, 0, 0);
                ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.299999, 1, 1, 1, 0, 0);
                IsTazed[playerid] =3;
            }
        }
    }
    return 1;
}
Reply
#4

You should check if issuerid is a valid player before using it in arrays. So change:
pawn Код:
if(gTeam[issuerid] == TEAM_COP || gTeam[issuerid] == TEAM_ARMYAIR || gTeam[playerid] == TEAM_ARMYLAND || gTeam[issuerid] == TEAM_CIA || gTeam[issuerid] == TEAM_SWAT)
to:
pawn Код:
if(issuerid != INVALID_PLAYER_ID && (gTeam[issuerid] == TEAM_COP || gTeam[issuerid] == TEAM_ARMYAIR || gTeam[playerid] == TEAM_ARMYLAND || gTeam[issuerid] == TEAM_CIA || gTeam[issuerid] == TEAM_SWAT))
About the other array index out of bounds, I'd suggest you to compile with debug info (-d3)
-> https://github.com/Zeex/samp-plugin-...ith-debug-info
in order to get the line caused it instead of searching the whole OnPlayerDisconnect callback. If you don't use the latest version (4.13) of crashdetect plugin, then update it: https://github.com/Zeex/samp-plugin-...ases/tag/v4.13

Re-compile, start the server and if it gives another debug messages, post your server log.
Reply
#5

I Was also wondering what causes this "Array index out of bounds" message "OnPlayerTakeDamage" callback, but I Simply added "if (IsPlayerConnected())" checks in beginning of the function. It worked properly then.
Reply
#6

I tried Konstantinos issues it doesn't work it also appeared here

Код:
[23:01:57] [debug] #2 00068c30 in public OnPlayerCommandText (0x00000001, 0x0026cda4) from Beta.amx
Reply
#7

Of course it did work. That's another run time error and OnPlayerCommandText callback has nothing to do with either OnPlayerTakeDamage or OnPlayerDisconnect callbacks you got problems with before.

Furthermore, this line says almost nothing. A run time error or crash was caused inside OnPlayerCommandText callback but there are 2 patterns before it so without using -d3 for more information such as lines, I cannot help you (neither nobody else).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)