05.01.2016, 09:34
Hello, I have tried to debug all these backtraces down to the cause lines and have had no luck, maybe some of you guys might have a anwser. Thank you
[03:01:12] [debug] Run time error 4: "Array index out of bounds"
[03:01:12] [debug] Accessing element at index 10 past array upper bound 9
[03:01:12] [debug] AMX backtrace:
[03:01:12] [debug] #0 00061e24 in FormatHouseWeapons (house=1, string[]=@0x05e85840 "") at C:\Users\Nick\Desktop\Ingenious!\gamemodes\test2.p wn:7070
[03:01:12] [debug] #1 000620d0 in UpdateHouseInfo (houseid=1) at C:\Users\Nick\Desktop\Ingenious!\gamemodes\test2.p wn:7089
[03:01:12] [debug] #2 000cf45c in public GlobalSaving () at C:\Users\Nick\Desktop\Ingenious!\gamemodes\test2.p wn:15460
\
[03:01:12] [debug] Run time error 4: "Array index out of bounds"
[03:01:12] [debug] Accessing element at index 10 past array upper bound 9
[03:01:12] [debug] AMX backtrace:
[03:01:12] [debug] #0 00061e24 in FormatHouseWeapons (house=1, string[]=@0x05e85840 "") at C:\Users\Nick\Desktop\Ingenious!\gamemodes\test2.p wn:7070
[03:01:12] [debug] #1 000620d0 in UpdateHouseInfo (houseid=1) at C:\Users\Nick\Desktop\Ingenious!\gamemodes\test2.p wn:7089
[03:01:12] [debug] #2 000cf45c in public GlobalSaving () at C:\Users\Nick\Desktop\Ingenious!\gamemodes\test2.p wn:15460
Код:
stock FormatHouseWeapons(house, string[]) { new wstr[256]; new tmp[64]; for(new a = 1; a < MAX_HOUSE_WEAPONS; a++) { new w = HouseInfo[house][hWeapon][a]; new am = HouseInfo[house][hAmmo][a]; if(a == 1) { format(tmp,sizeof(tmp),"%d=%d",w,am); } else { format(tmp,sizeof(tmp),"|%d=%d",w,am); } strins(wstr,tmp,strlen(wstr)); } return format(string, 256, "%s", wstr); }
Код:
stock UpdateHouseInfo(houseid) { new weapons[256]; FormatHouseWeapons(houseid, weapons); format(query, sizeof(query), "UPDATE `houses` SET `owner` = '%s', `owned` = %d, `locked` = %d, `price`= %d, `levelbuy`= %d, `rentprice` = %d, `rentable` = %d, `interior` = %d, `world` = %d, `cash` = %d, `furnitures` = %d WHERE `id` = %d", HouseInfo[houseid][hOwner], HouseInfo[houseid][hOwned], HouseInfo[houseid][hLocked], HouseInfo[houseid][hPrice], HouseInfo[houseid][hLevelbuy], HouseInfo[houseid][hRentprice], HouseInfo[houseid][hRentable], HouseInfo[houseid][hInterior], HouseInfo[houseid][hWorld], HouseInfo[houseid][hCash], HouseInfo[houseid][hFurnitures], HouseInfo[houseid][hID]); mysql_function_query(dbHandle, query, false, "", ""); format(query, sizeof(query), "UPDATE `houses` SET `checkx` = %f, `checky` = %f, `checkz` = %f, `weapons` = '%s', `radio` = %d WHERE `id` = %d", HouseInfo[houseid][hCheckPosX], HouseInfo[houseid][hCheckPosY], HouseInfo[houseid][hCheckPosZ], weapons, HouseInfo[houseid][hRadio], HouseInfo[houseid][hID]); mysql_function_query(dbHandle, query, false, "", ""); return 1; }
Код:
public GlobalSaving() { //------------------------------------------------- foreach(Player, i) { SavePlayerStats(i); } //------------------------------------------------- for(new i = 0; i < MAX_PARK_METERS; i++) { if(ParkMeters[i][parkOn]) { SaveParkMeter(i); } } //------------------------------------------------- for(new i = 0; i < MAX_VEHICLES; i++) { if(VehicleInfo[i][carOwned] == 1) { SaveVehicle(i); } } //------------------------------------------------- for(new i = 1; i < MAX_HOUSES; i++) { if(HouseInfo[i][hHouseOn] == 1 && HouseInfo[i][hOwned] == 1) { UpdateHouseInfo(i); } } //------------------------------------------------- for(new i = 0; i < MAX_BIZ; i++) { if(BizInfo[i][bizOn] == 1) { UpdateBizInfo(i); } } //------------------------------------------------- for(new i = 0; i < MAX_FACTIONS; i++) { if(Factions[i][fON] == 1) { SaveFaction(i); } } //------------------------------------------------- SavePlants(); return 1; }