new PlayerText:TXT_TD_Text[MAX_PLAYERS][12];
new PlayerWeapon[MAX_PLAYERS][13][P_WEAPONS];
for (new i = 0; i <= 12; i++) {
PlayerTextDrawSetPreviewRot(playerid,TXT_TD_Update[playerid][i], 0,0,0, 5.0);
switch(PlayerWeapon[playerid][i][P_WeaponID]) {
case 0: { format(string,sizeof(string),"Ammo: N/A"); UpdateEmptyInventory(playerid,i,string); }
default: { format(string,sizeof(string),"Ammo: %i",PlayerWeapon[playerid][i][P_Ammo]); UpdateInventory(playerid, i, GetGunObjectID(PlayerWeapon[playerid][i][P_WeaponID]),string); }
}
}
|
[00:20:47] [debug] #2 000300d4 in ?? (0, 6139636, 0, 0, 0, 8, 0, 6139636, 0, 0, ... <1073741813 arguments>) from test.amx [00:20:47] [debug] #3 00007fbc in public OnPlayerCommandText (0, 6139636) from test.amx |
|
Compile your script using this:
https://github.com/Zeex/samp-plugin-...ith-debug-info And then reproduce the error, and post the console log. It should print out more information. |
[01:10:04] [debug] Run time error 4: "Array index out of bounds"
[01:10:04] [debug] Accessing element at index 12 past array upper bound 11
[01:10:04] [debug] AMX backtrace:
[01:10:04] [debug] #0 000513ec in ?? (0, 6139916, 0) from test.amx
[01:10:04] [debug] #1 0002e338 in ?? (0, 6139876, 0) from test.amx
[01:10:04] [debug] #2 000301f4 in ?? (0, 6139876, 0, 0, 0, 8, 0, 6139876, 0, 0, ... <1073741813 arguments>) from test.amx
[01:10:04] [debug] #3 000080dc in public OnPlayerCommandText (0, 6139876) from test.amx
new PlayerText:TXT_TD_Text[MAX_PLAYERS][ 12 ];
new PlayerWeapon[MAX_PLAYERS][13][P_WEAPONS];
for (new i = 0; i <= 12; i++) {
PlayerTextDrawSetPreviewRot(playerid,TXT_TD_Update[playerid][ i ], 0,0,0, 5.0);
|
Here is the mistake:
Код:
new PlayerText:TXT_TD_Text[MAX_PLAYERS][ 12 ];
new PlayerWeapon[MAX_PLAYERS][13][P_WEAPONS];
for (new i = 0; i <= 12; i++) {
PlayerTextDrawSetPreviewRot(playerid,TXT_TD_Update[playerid][ i ], 0,0,0, 5.0);
|