06.11.2016, 07:50
Quote:
The size of VMachines array is 43, this means the valid indexes are 0-42. Using sizeof is the best choice so if you add or remove data from the array you won't have to worry about run time error 4 again.
pawn Код:
|
Quote:
[debug] AMX backtrace: [debug] #0 000c9f04 in public OnPlayerDeath (playerid=0, killerid=65535, reason=255) at D:\xax.pwn:7539 [debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at index 65535 in array of size 1000 |
And one more;
Код:
[debug] AMX backtrace: [debug] #0 0001c100 in ShowPlayerBuyable (playerid=0) at D:\pawno\include\mSelection.inc:609 [debug] #1 0001f15c in public Dialog_OnPlayerClickPlayerTD (playerid=0, PlayerText:playertextid=213) at D:\pawno\include\mSelection.inc:933 [debug] #2 0000b840 in public OnPlayerClickPlayerTextDraw (playerid=0, PlayerText:playertextid=213) at D:\pawno\include\dialogs.inc:717 [debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at negative index -399 In mSelection.inc Line 609 gVehicleName[playerid][x] = CreateVehicleName(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, VehicleNames2[gItemList[itemat][mS_ITEM_MODEL]-400], GetVehiclePrice2(gItemList[itemat][mS_ITEM_MODEL])); In mSelection.inc Line 933 ShowPlayerBuyable(playerid); stock ShowPlayerBuyable(playerid) { new bgcolor = GetPVarInt(playerid, "mS_previewBGcolor"); new x=0; new Float:BaseX = mS_DIALOG_BASE_X; new Float:BaseY = mS_DIALOG_BASE_Y - (mS_SPRITE_DIM_Y * 0.33); // down a bit new linetracker = 0; new mS_listID = mS_GetPlayerCurrentListID(playerid); if(mS_listID == mS_CUSTOM_LISTID) { new itemat = (GetPVarInt(playerid, "mS_list_page") * mS_SELECTION_ITEMS); new Float:rotzoom[4]; rotzoom[0] = GetPVarFloat(playerid, "mS_custom_Xrot"); rotzoom[1] = GetPVarFloat(playerid, "mS_custom_Yrot"); rotzoom[2] = GetPVarFloat(playerid, "mS_custom_Zrot"); rotzoom[3] = GetPVarFloat(playerid, "mS_custom_Zoom"); new itemamount = mS_GetAmountOfListItemsEx(playerid); // Destroy any previous ones created mS_DestroyPlayerMPs(playerid); while(x != mS_SELECTION_ITEMS && itemat < (itemamount)) { if(linetracker == 0) { BaseX = mS_DIALOG_BASE_X + 25.0; // in a bit from the box BaseY += mS_SPRITE_DIM_Y + 1.0; // move on the Y for the next line } gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gCustomList[playerid][itemat], BaseX, BaseY, rotzoom[0], rotzoom[1], rotzoom[2], rotzoom[3], mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor); gSelectionItemsTag[playerid][x] = gCustomList[playerid][itemat]; BaseX += mS_SPRITE_DIM_X + 1.0; // move on the X for the next sprite linetracker++; if(linetracker == mS_ITEMS_PER_LINE) linetracker = 0; itemat++; x++; } } else { new itemat = (gLists[mS_listID][mS_LIST_START] + (GetPVarInt(playerid, "mS_list_page") * mS_SELECTION_ITEMS)); // Destroy any previous ones created mS_DestroyPlayerMPs(playerid); while(x != mS_SELECTION_ITEMS && itemat < (gLists[mS_listID][mS_LIST_END]+1)) { if(linetracker == 0) { BaseX = mS_DIALOG_BASE_X + 25.0; // in a bit from the box BaseY += mS_SPRITE_DIM_Y + 1.0; // move on the Y for the next line } new rzID = gItemList[itemat][mS_ITEM_ROT_ZOOM_ID]; // avoid long line if(rzID > -1) gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, gRotZoom[rzID][0], gRotZoom[rzID][1], gRotZoom[rzID][2], gRotZoom[rzID][3], mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor); else gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, 0.0, 0.0, 0.0, 1.0, mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor); gVehicleName[playerid][x] = CreateVehicleName(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, VehicleNames2[gItemList[itemat][mS_ITEM_MODEL]-400], GetVehiclePrice2(gItemList[itemat][mS_ITEM_MODEL])); gSelectionItemsTag[playerid][x] = gItemList[itemat][mS_ITEM_MODEL]; BaseX += mS_SPRITE_DIM_X + 1.0; // move on the X for the next sprite linetracker++; if(linetracker == mS_ITEMS_PER_LINE) linetracker = 0; itemat++; x++; } } }