Need Help, error 032: array index out of bounds (variable "MapInfo") - 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: Need Help, error 032: array index out of bounds (variable "MapInfo") (
/showthread.php?tid=305089)
Need Help, error 032: array index out of bounds (variable "MapInfo") -
graceda - 21.12.2011
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
Re: Need Help, error 032: array index out of bounds (variable "MapInfo") -
[HiC]TheKiller - 21.12.2011
MAX_MAPS exceeds the size of MapInfo. Can we see the exact size of MapInfo?
Re: Need Help, error 032: array index out of bounds (variable "MapInfo") -
graceda - 22.12.2011
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];
Re: Need Help, error 032: array index out of bounds (variable "MapInfo") -
Tee - 22.12.2011
What lines is the error on?
Re: Need Help, error 032: array index out of bounds (variable "MapInfo") -
Steven82 - 22.12.2011
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.