Need Help, error 032: array index out of bounds (variable "MapInfo")
#1

i have this error
Код:
error 032: array index out of bounds (variable "MapInfo")
and this is my Script

Код:
public LoadsMap()
{
	new file[64];
	for(new idx = 0; idx < MAX_MAPS ; idx++)
	{
	    format(file, sizeof(file),"map/%d.ini", idx);
	    if(dini_Exists(file))
		{
			strmid(MapInfo[idx][Name], dini_Get(file,"Name"), 0, strlen(dini_Get(file,"Name")), 255);
			strmid(MapInfo[idx][Author], dini_Get(file,"Author"), 0, strlen(dini_Get(file,"Author")), 255);
			MapInfo[idx][HSpawnX] = dini_Float(file,"HSpawn_X");
			MapInfo[idx][HSpawnY] = dini_Float(file,"HSpawn_Y");
			MapInfo[idx][HSpawnZ] = dini_Float(file,"HSpawn_Z");
			MapInfo[idx][ZSpawnX] = dini_Float(file,"ZSpawn_X");
			MapInfo[idx][ZSpawnY] = dini_Float(file,"ZSpawn_Y");
			MapInfo[idx][ZSpawnZ] = dini_Float(file,"ZSpawn_Z");
			MapInfo[idx][Ada] = 1;
		}
	}
	print("[SCRIPT]: Loaded Map");
	return 1;
}
any help please?

#Sorry for my bad english
Reply
#2

MAX_MAPS exceeds the size of MapInfo. Can we see the exact size of MapInfo?
Reply
#3

are you mean this?

Код:
#define MAX_MAPS 200

enum mInfo {
	Name[34],
	Author[34],
	Float:HSpawnX,
	Float:HSpawnY,
	Float:HSpawnZ,
	Float:ZSpawnX,
	Float:ZSpawnY,
	Float:ZSpawnZ,
	Ada = 0
}

new	MapInfo[MAX_MAPS][mInfo];
Reply
#4

What lines is the error on?
Reply
#5

Try using these lines instead.

pawn Код:
strmid(MapInfo[idx][Name], dini_Get(file,"Name"), 0, strlen(dini_Get(file,"Name")), 34);
strmid(MapInfo[idx][Author], dini_Get(file,"Author"), 0, strlen(dini_Get(file,"Author")), 34);
Since your max limit in the enum is 34 and you had it set to 255 where i put 34.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)