PDA

View Full Version : Need Help, error 032: array index out of bounds (variable "MapInfo")


graceda
21/12/2011, 07:11 AM
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

[HiC]TheKiller
21/12/2011, 07:28 AM
MAX_MAPS exceeds the size of MapInfo. Can we see the exact size of MapInfo?

graceda
22/12/2011, 03:17 AM
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];

Tee
22/12/2011, 03:46 AM
What lines is the error on?

Steven82
22/12/2011, 05:32 AM
Try using these lines instead.


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.