SA-MP Forums Archive
[debug] Accessing element at index 51 past array upper bound 50 [+REP] - 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: [debug] Accessing element at index 51 past array upper bound 50 [+REP] (/showthread.php?tid=537191)



[debug] Accessing element at index 51 past array upper bound 50 [+REP] - PawnOX - 14.09.2014

I get spammed with this errors.

Code:
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42067c0c, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x421c48d8, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x423215a5, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x4247e272, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x425daf3e, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42737c0b, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x4284a46c, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x428f8ad2, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x429a7139, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42a5579f, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42b03e05, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42bb246c, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42c60ad2, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42d0f139, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42dbd79f, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42e6be05, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42f1a46c, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42fc8ad2, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x415eb2c2, 0x43340000) from buttons.amx
[10:03:32] [debug] Run time error 4: "Array index out of bounds"
[10:03:32] [debug]  Accessing element at index 51 past array upper bound 50
[10:03:32] [debug] AMX backtrace:
[10:03:32] [debug] #0 000008e0 in public FS_CreateButton (0x44df9c75, 0xc4a2c754, 0x415a8177, 0x43870000) from buttons.amx
FS_Createbutton

pawn Code:
forward FS_CreateButton(Float:X, Float:Y, Float:Z, Float:Angle);
public FS_CreateButton(Float:X, Float:Y, Float:Z, Float:Angle)
{
    new buttonid;

    for(buttonid = 1; buttonid <= MAX_BUTTONS; buttonid ++)
        if (!ButtonInfo[buttonid][Created])
            break;

    ButtonInfo[buttonid][ObjectID]  = CreateObject(OBJECT,X,Y,Z,0.0,0.0,Angle);
    ButtonInfo[buttonid][Pos][0]    = X;
    ButtonInfo[buttonid][Pos][1]    = Y;
    ButtonInfo[buttonid][Pos][2]    = Z;
    ButtonInfo[buttonid][Pos][3]    = Angle;
    ButtonInfo[buttonid][Moving]    = false;
    ButtonInfo[buttonid][Created]   = true;

    for (new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
        ButtonInfo[buttonid][Usable][playerid] = true;

    return buttonid;
}
THANKS IN ADVANCE <3 <3

Imma give an +Rep


Re: [debug] Accessing element at index 51 past array upper bound 50 [+REP] - dusk - 14.09.2014

pawn Code:
for(buttonid = 1; buttonid <= MAX_BUTTONS; buttonid ++)
        if (!ButtonInfo[buttonid][Created])
            break;
This loop. How much is MAX_BUTTONS? Why do you start at 1 ?

You loop until buttonid is less than or equal to MAX_BUTTONS, if ButtonInfo size is also BUTTON_INFO then index MAX_BUTTONS is out of bounds....

Anyhow, try this code:
pawn Code:
for(buttonid = 0; buttonid < MAX_BUTTONS; buttonid ++)
        if (!ButtonInfo[buttonid][Created])
            break;



Re: [debug] Accessing element at index 51 past array upper bound 50 [+REP] - PawnOX - 14.09.2014

Quote:
Originally Posted by dusk
View Post
pawn Code:
for(buttonid = 1; buttonid <= MAX_BUTTONS; buttonid ++)
        if (!ButtonInfo[buttonid][Created])
            break;
This loop. How much is MAX_BUTTONS? Why do you start at 1 ?

You loop until buttonid is less than or equal to MAX_BUTTONS, if ButtonInfo size is also BUTTON_INFO then index MAX_BUTTONS is out of bounds....

Anyhow, try this code:
pawn Code:
for(buttonid = 0; buttonid < MAX_BUTTONS; buttonid ++)
        if (!ButtonInfo[buttonid][Created])
            break;

Oh

my

god


THAAAAAAAAANKSSSSSSSS <3 <3 + REP!!