SA-MP Forums Archive
Crash detect Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Crash detect Help (/showthread.php?tid=449828)



Crash detect Help - nguyenquynh - 10.07.2013

Hello guys , i installed Crash detect plugin into my game mode
And i am getting this error :

Код:
[19:15:49] [debug] Run time error 4: "Array index out of bounds"
[19:15:49] [debug]   Accessing element at index 22 past array upper bound 19
[19:15:49] [debug] AMX backtrace:
[19:15:49] [debug] #0  0001db5c in public OnQueryFinish () from GTA_MYSQL1.amx
CRASH
Код:
case LOADCRATE_THREAD:
		{
		    for(new i; i < rows; i++)
		    {
				new crateid, szResult[32], string[128];
				cache_get_field_content(i, "id", szResult, MainPipeline); crateid = strval(szResult);
				cache_get_field_content(i, "Active", szResult, MainPipeline); CrateInfo[crateid][crActive] = strval(szResult);
				cache_get_field_content(i, "CrateX", szResult, MainPipeline); CrateInfo[crateid][crX] = strval(szResult);
				cache_get_field_content(i, "CrateY", szResult, MainPipeline); CrateInfo[crateid][crY] = strval(szResult);
				cache_get_field_content(i, "CrateZ", szResult, MainPipeline); CrateInfo[crateid][crZ] = strval(szResult);
				cache_get_field_content(i, "GunQuantity", szResult, MainPipeline); CrateInfo[crateid][GunQuantity] = strval(szResult);
				cache_get_field_content(i, "InVehicle", szResult, MainPipeline); CrateInfo[crateid][InVehicle] = strval(szResult);
				if(CrateInfo[crateid][InVehicle] != INVALID_VEHICLE_ID)
				{
				    CrateInfo[crateid][crActive] = 0;
				    CrateInfo[crateid][InVehicle] = INVALID_VEHICLE_ID;
				}
				if(CrateInfo[crateid][crActive])
				{
					CrateInfo[crateid][InVehicle] = INVALID_VEHICLE_ID;
				    CrateInfo[crateid][crObject] = CreateDynamicObject(964,CrateInfo[crateid][crX],CrateInfo[crateid][crY],CrateInfo[crateid][crZ],0.00000000,0.00000000,0.00000000);
				    format(string, sizeof(string), "Serial Number: #%d\n High Grade Materials: %d/50", i, CrateInfo[i][GunQuantity]);
				    CrateInfo[crateid][crLabel] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, CrateInfo[crateid][crX],CrateInfo[crateid][crY],CrateInfo[crateid][crZ]+1, 20.0, _, _, 1, 0, 0, _, 20.0);

				}
		    }
		    print("[LoadCrates] Loading Crates Finished");
		    mysql_SaveCrates();
		}
	}
	return 1;
}
I've increased all arrays under OnQueryFinish but still , why then?
Can i even ignore this ?


Re: Crash detect Help - Calabresi - 10.07.2013

What's the size of CrateInfo enum? You are probably exceeding maximum ID that a crate can have.

pawn Код:
CrateInfo[i][GunQuantity]



Re: Crash detect Help - Misiur - 10.07.2013

Could you show us your CrateInfo initialisation? Looks like there are more rows than CrateInfo rows, or there is some string with length smaller than info you want to put in it.