[18:29:52] [debug] Run time error 4: "Array index out of bounds" [18:29:52] [debug] Accessing element at index 51 past array upper bound 50 [18:29:52] [debug] AMX backtrace: [18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x425daf3e, 0x43340000) from buttons.amx [18:29:52] [debug] Run time error 4: "Array index out of bounds" [18:29:52] [debug] Accessing element at index 51 past array upper bound 50 [18:29:52] [debug] AMX backtrace: [18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42737c0b, 0x43340000) from buttons.amx [18:29:52] [debug] Run time error 4: "Array index out of bounds" [18:29:52] [debug] Accessing element at index 51 past array upper bound 50 [18:29:52] [debug] AMX backtrace: [18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x4284a46c, 0x43340000) from buttons.amx [18:29:52] [debug] Run time error 4: "Array index out of bounds" [18:29:52] [debug] Accessing element at index 51 past array upper bound 50 [18:29:52] [debug] AMX backtrace: [18:29:52] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x428f8ad2, 0x43340000) from buttons.amx [18:29:52] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x429a7139, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42a5579f, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42b03e05, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42bb246c, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42c60ad2, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42d0f139, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42dbd79f, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42e6be05, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42f1a46c, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x42fc8ad2, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44defc9f, 0xc4a2a3d0, 0x415eb2c2, 0x43340000) from buttons.amx [18:29:53] [debug] Run time error 4: "Array index out of bounds" [18:29:53] [debug] Accessing element at index 51 past array upper bound 50 [18:29:53] [debug] AMX backtrace: [18:29:53] [debug] #0 000008e0 in public FS_CreateButton (0x44df9c75, 0xc4a2c754, 0x415a8177, 0x43870000) from buttons.amx
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; }
for(buttonid = 0; buttonid < MAX_BUTTONS; buttonid ++)
MAX_BUTTONS buttons is 51. A normal loop would go from 0 to 50. Your code goes from 1-51 and the last valid index is 50; hence the run time error. Use the first index and don't exceed the array's size:
Change to: pawn Код:
|