[05:37:32] [debug] Run time error 4: "Array index out of bounds" [05:37:32] [debug] Attempted to read/write array element at negative index -1 [05:37:32] [debug] AMX backtrace: [05:37:32] [debug] #0 0007b800 in ?? (15) in word.amx [05:37:32] [debug] #1 000c0b3c in public OnQueryFinished (14, 0) in word.amx
} forward OnQueryFinished(threadid, extraid); public OnQueryFinished(threadid, extraid) { new rows = cache_get_row_count(connectionID); switch(threadid) { case THREAD_LOOKUP_BANS: { if(rows) { new bannedby[24], date[24], reason[128]; cache_get_field_content(0, "bannedby", bannedby); cache_get_field_content(0, "date", date); cache_get_field_content(0, "reason", reason); GameTextForPlayer(extraid, "~r~You are banned!", 999999, 3); TextDrawHideForPlayer(extraid, welcomenew); if(cache_get_field_content_int(0, "permanent")) SendClientMessageEx(extraid, COLOR_YELLOW, "You are permanently banned from this server."); else SendClientMessageEx(extraid, COLOR_YELLOW, "You are banned from this server. You can appeal your ban at Deviation.cf."); SendClientMessageEx(extraid, COLOR_LIGHTRED, "Admin: %s", bannedby); SendClientMessageEx(extraid, COLOR_LIGHTRED, "Date: %s", date); SendClientMessageEx(extraid, COLOR_LIGHTRED, "Reason: %s", reason); KickPlayer(extraid); } else { mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "SELECT uid FROM users WHERE username = '%s'", GetPlayerNameEx(extraid)); mysql_tquery(connectionID, queryBuffer, "OnQueryFinished", "ii", THREAD_LOOKUP_ACCOUNT, extraid); } } case THREAD_LOOKUP_ACCOUNT: { if(rows) {
The error explains that you are trying to access array with negative number index, i.e. Array[-1]
Show the part of code where the threadid is in switch case 14 (#define THREAD_?_? 14) |
} case THREAD_LOAD_BUSINESSES: { for(new i = 0; i < rows && i < MAX_BUSINESSES; i ++) { cache_get_field_content(i, "owner", BusinessInfo[i][bOwner], connectionID, MAX_PLAYER_NAME); cache_get_field_content(i, "description", BusinessInfo[i][bDescription], 128); BusinessInfo[i][bID] = cache_get_field_content_int(i, "id"); BusinessInfo[i][bOwnerID] = cache_get_field_content_int(i, "ownerid"); BusinessInfo[i][bType] = cache_get_field_content_int(i, "type"); BusinessInfo[i][bPrice] = cache_get_field_content_int(i, "price"); BusinessInfo[i][bEntryFee] = cache_get_field_content_int(i, "entryfee"); BusinessInfo[i][bLocked] = cache_get_field_content_int(i, "locked"); BusinessInfo[i][bTimestamp] = cache_get_field_content_int(i, "timestamp"); BusinessInfo[i][bPosX] = cache_get_field_content_float(i, "pos_x"); BusinessInfo[i][bPosY] = cache_get_field_content_float(i, "pos_y"); BusinessInfo[i][bPosZ] = cache_get_field_content_float(i, "pos_z"); BusinessInfo[i][bPosA] = cache_get_field_content_float(i, "pos_a"); BusinessInfo[i][bIntX] = cache_get_field_content_float(i, "int_x"); BusinessInfo[i][bIntY] = cache_get_field_content_float(i, "int_y"); BusinessInfo[i][bIntZ] = cache_get_field_content_float(i, "int_z"); BusinessInfo[i][bIntA] = cache_get_field_content_float(i, "int_a"); BusinessInfo[i][bInterior] = cache_get_field_content_int(i, "interior"); BusinessInfo[i][bWorld] = cache_get_field_content_int(i, "world"); BusinessInfo[i][bOutsideInt] = cache_get_field_content_int(i, "outsideint"); BusinessInfo[i][bOutsideVW] = cache_get_field_content_int(i, "outsidevw"); BusinessInfo[i][bCash] = cache_get_field_content_int(i, "cash"); BusinessInfo[i][bProducts] = cache_get_field_content_int(i, "products"); BusinessInfo[i][bMaterials] = cache_get_field_content_int(i, "materials"); BusinessInfo[i][bColor] = cache_get_field_content_int(i, "color"); BusinessInfo[i][bText] = Text3D:INVALID_3DTEXT_ID; BusinessInfo[i][bPickup] = -1; BusinessInfo[i][bMapIcon] = -1; BusinessInfo[i][bExists] = 1; Iter_Add(Business, i); ReloadBusiness(i); } printf("[Script] %i businesses loaded.", rows); }
} ReloadBusiness(businessid) { if(BusinessInfo[businessid][bExists]) { new string[128]; DestroyDynamic3DTextLabel(BusinessInfo[businessid][bText]); DestroyDynamicPickup(BusinessInfo[businessid][bPickup]); DestroyDynamicMapIcon(BusinessInfo[businessid][bMapIcon]); if(BusinessInfo[businessid][bOwnerID] == 0) { format(string, sizeof(string), "[Business]\nPrice: %s\nType: %s\nEntry Fee: $%i\nStatus: %s", FormatNumber(BusinessInfo[businessid][bPrice]), bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{ffff00}Closed") : ("{00AA00}Opened")); } else { format(string, sizeof(string), "[Business]\nOwner: %s\nType: %s\nEntry Fee: $%i\nStatus: %s", BusinessInfo[businessid][bOwner], bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{FFFF00}Closed") : ("{00AA00}Opened")); } BusinessInfo[businessid][bText] = CreateDynamic3DTextLabel(string, COLOR_GREY1, BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ] + 0.1, 10.0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt]); BusinessInfo[businessid][bPickup] = CreateDynamicPickup(1272, 1, BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt]); switch(BusinessInfo[businessid][bType]) { case BUSINESS_STORE: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 17, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); case BUSINESS_GUNSHOP: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 6, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); case BUSINESS_CLOTHES: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 45, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); case BUSINESS_RESTAURANT: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 10, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); case BUSINESS_GYM: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 54, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); case BUSINESS_AGENCY: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 58, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); case BUSINESS_BARCLUB: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 49, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); case BUSINESS_TOOLSHOP: BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 11, 0, .worldid = BusinessInfo[businessid][bOutsideVW], .interiorid = BusinessInfo[businessid][bOutsideInt], .style = MAPICON_GLOBAL); } }
bizInteriors[BusinessInfo[businessid][bType]][intType]