Array error
#1

Greetings i made someting dynamic but it give me this error when i start the server
Код:
[18:11:11] [debug] Run time error 4: "Array index out of bounds"
[18:11:11] [debug]  Accessing element at index 20 past array upper bound 19
[18:11:11] [debug] AMX backtrace:
[18:11:11] [debug] #0 000c9ee4 in public OnLoadViplockerPoints () from DCRP.amx
[18:11:11] [LoadDynamicDoors] 2000 doors rehashed/loaded.
[18:11:11] [LoadDynamicMapIcons] 1 map icons rehashed/loaded.
[18:11:11] [LoadDynamicTexts] 1000 Texts Labels rehashed/loaded.
in the gamemode i have no errors

thanks in advance
Reply
#2

Show OnLoadViplocker()
Reply
#3

Post here your public OnLoadViplockerPoints ()
Reply
#4

Код:
forward OnLoadViplockerPoints();
public OnLoadViplockerPoints()
{
	new i, rows, fields, tmp[128], string[128];
	cache_get_data(rows, fields, MainPipeline);

	while(i < rows)
	{
		cache_get_field_content(i, "id", tmp, MainPipeline);  ViplockerPoints[i][viplockerSQLId] = strval(tmp);
		cache_get_field_content(i, "PosX", tmp, MainPipeline); ViplockerPoints[i][viplockerPosX] = floatstr(tmp);
		cache_get_field_content(i, "PosY", tmp, MainPipeline); ViplockerPoints[i][viplockerPosY] = floatstr(tmp);
		cache_get_field_content(i, "PosZ", tmp, MainPipeline); ViplockerPoints[i][viplockerPosZ] = floatstr(tmp);
		cache_get_field_content(i, "VW", tmp, MainPipeline); ViplockerPoints[i][viplockerVW] = strval(tmp);
		cache_get_field_content(i, "Int", tmp, MainPipeline); ViplockerPoints[i][viplockerInt] = strval(tmp);
		if(ViplockerPoints[i][viplockerPosX] != 0)
		{
			format(string, sizeof(string), "Vip Locker #%d\nType /viplocker to open it.", i);
			ViplockerPoints[i][viplockerTextID] = CreateDynamic3DTextLabel(string, COLOR_PURPLE, ViplockerPoints[i][viplockerPosX], ViplockerPoints[i][viplockerPosY], ViplockerPoints[i][viplockerPosZ]+0.6, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ViplockerPoints[i][viplockerVW], ViplockerPoints[i][viplockerInt], -1);
		}
		i++;
	}
}
Reply
#5

Just because there are no errors when compiling doesn't necessarily suggest that there will not be any errors during runtime. The PAWN compiler is extremely dumb compared to most modern compilers.

As the error suggests one of your array indexes are out of bounds. Judging by the code you have provided this is most likely present in the ViplockerPoints array. You need to do some research as to what this means as you are likely to experience this often. Search these forums as the questions has been answered many times before.
Reply
#6

Quote:
Originally Posted by Jay_
Посмотреть сообщение
Just because there are no errors when compiling doesn't necessarily suggest that there will not be any errors during runtime. The PAWN compiler is extremely dumb compared to most modern compilers.

As the error suggests one of your array indexes are out of bounds. Judging by the code you have provided this is most likely present in the ViplockerPoints array. You need to do some research as to what this means as you are likely to experience this often. Search these forums as the questions has been answered many times before.
can it be in the mysql database ?
Reply
#7

Problem has been solved

Thanks to Jay_
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)