SA-MP Forums Archive
recieving errors.. - 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: recieving errors.. (/showthread.php?tid=655447)



recieving errors.. - div - 21.06.2018

Code:
[19:16:50] [debug] Run time error 4: "Array index out of bounds"
[19:16:50] [debug]  Accessing element at index 24 past array upper bound 23
[19:16:50] [debug] AMX backtrace:
[19:16:50] [debug] #0 00013234 in public Wanteds () from CNR.amx
That's what i got from SERVER LOG..


Please help


Re: recieving errors.. - Revy - 21.06.2018

Compile with -d3. Here’s how you do it: create a new file named pawn.cfg inside your pawno folder and just put -d3 inside it, save and re-compile then give me the line number. This is called debug level 3.


Re: recieving errors.. - div - 21.06.2018

Header size: 4456 bytes
Code size: 111612 bytes
Data size: 59916 bytes
Stack/heap size: 16384 bytes; estimated max. usage=497 cells (1988 bytes)
Total requirements: 192368 bytes

1 Warning.


EDIT: the warning isn't related, it's related to not using a function.


Re: recieving errors.. - Private200 - 21.06.2018

Show us your "Wanteds" function in the script.


Re: recieving errors.. - div - 21.06.2018

Code:
    if(GetPVarInt(playerid,"Wanted") != pInfo[playerid][pWanted])
{
    new wlvl[9];
    format(wlvl, 9, "%d", pInfo[playerid][pWanted]);
    PlayerTextDrawSetString(playerid, WLvlTD[playerid], wlvl);
    SetPVarInt(playerid,"Wanted", pInfo[playerid][pWanted]);
    new query[128], name[24];
    GetPlayerName(playerid, name, 24);
    format(query, sizeof(query), "UPDATE `playerdata` SET `wanted` = '%d' WHERE `username` = '%s'", pInfo[playerid][pWanted], name);
    mysql_tquery(dbHandle, query);

    new starCount = 0, genTextStr[30];
    if(pInfo[playerid][pWanted] > 0)
	{
        format(genTextStr, sizeof genTextStr, "");
        for(new i = 0; i < pInfo[playerid][pWanted]; i++)
		{
            starCount++;
            if(starCount == 7)
			{
                break;
            }
            else
			{
                strcat(genTextStr, "[]", sizeof genTextStr);
            }
        }
        PlayerTextDrawSetString(playerid, wLvlStars[playerid], genTextStr);
    }

    if(pInfo[playerid][pWanted] == 0) {
        PlayerTextDrawSetString(playerid, wLvlStars[playerid], "");
    }
PRIVATE200 :@ XD


Re: recieving errors.. - div - 21.06.2018

fixed