SA-MP Forums Archive
why did this happen ? i cant fix it ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: why did this happen ? i cant fix it ? (/showthread.php?tid=130056)



why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

Код:
 error 032: array index out of bounds (variable "GangInfo")
.pwn(5413) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5414) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5415) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5416) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5428) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5429) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5430) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5431) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5432) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(7303) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7304) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7305) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7306) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7307) : error 032: array index out of bounds (variable "GangInfo")

Can any one help me with this ?


Re: why did this happen ? i cant fix it ? - Norn - 25.02.2010

Quote:
Originally Posted by AlbanianGuy
Код:
 error 032: array index out of bounds (variable "GangInfo")
.pwn(5413) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5414) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5415) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5416) : error 032: array index out of bounds (variable "GangInfo")
.pwn(5428) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5429) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5430) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5431) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(5432) : error 032: array index out of bounds (variable "ZoneInfo")
.pwn(7303) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7304) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7305) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7306) : error 032: array index out of bounds (variable "GangInfo")
.pwn(7307) : error 032: array index out of bounds (variable "GangInfo")

Can any one help me with this ?
Array is not big enough.


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

So what should i do ?



Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

and where can i find hte gang string ? or what ever it is ?


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

anyone ?...


Re: why did this happen ? i cant fix it ? - Miguel - 25.02.2010

We don't even know how is your GM coded but, press Ctrl + F, type GangInfo and look for it.


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

Yes i did but , i dont know .... it looks like this ? GangInfo[128] ?
and if i find it .. to waht number do i change it ?


Re: why did this happen ? i cant fix it ? - Miguel - 25.02.2010

Show us the lines 5413, 5414 and 5415.


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

LOOK I FOUND THESE
Код:
new GangInfo[MAX_GANGS][ginfo];
new ZoneInfo[MAX_ZONES+1][zinfo];

new GangZone_CurrentColour[MAX_ZONES];
and i changed them to
Quote:

new GangInfo[MAX_PLAYERS][ginfo];
new ZoneInfo[MAX_PLAYERS+1][zinfo];

new GangZone_CurrentColour[MAX_PLAYERS];

and i dint have those erros anymore .. is it a good thing ? will it work ?




Re: why did this happen ? i cant fix it ? - Miguel - 25.02.2010

No, it is not, you should know what is the max gangs and max zones. If you change it randomly you could be wasting a lot of memory or the opposite (not enough slots). Once again, show us the lines 5413, 5414 and 5415.


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

Код:
strmid(GangInfo[ TEAM_NORTH ][GangName], "NORTH", 0, strlen("NORTH"), MAX_PLAYER_NAME);
	strmid(GangInfo[ TEAM_SOUTH][GangName], "SOUTH", 0, strlen("SOUTH"), MAX_PLAYER_NAME);
	strmid(GangInfo[ TEAM_WEST ][GangName], "WEST", 0, strlen("WEST"), MAX_PLAYER_NAME);
those are 5413,5414,5415... i have other teams too ,, but it starts from these teams because these teams are the biggest ... like they have more classid .... u know hwat i mean ?


Re: why did this happen ? i cant fix it ? - Miguel - 25.02.2010

Well, I don't know what is the MAX_GANGS or MAX_ZONES, but you should do this:

pawn Код:
new GangInfo[MAX_GANGS][ginfo];
new ZoneInfo[MAX_ZONES+1][zinfo];
new GangZone_CurrentColour[MAX_ZONES];
// leave it like that, no more changes there.
Then, look for MAX_GANGS and MAX_ZONES:
pawn Код:
// MAX_GANGS should be something like:
#define MAX_GANGS value // change values for the max gangs that could be in your server.
// MAX_ZONES must be like:
#define MAX_ZONES value // change values for the max zones that could be in your server.
// remeber that value could be any number and if you want those errors fixed, you will have to find that VALUE



Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

Код:
#define MAX_GANGS 15
#define MAX_ZONES 14
Thats waht i found. Is it the right one ?


Re: why did this happen ? i cant fix it ? - Miguel - 25.02.2010

Yeah, change them to something greater. I suggest you to add +1 to each, compile and see if there are not errors. If there are, just add one more until you get no errors.


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

lol i got mad and i cahnged hte numbers to 3253453465346 lol .. ok i will lower them ...


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

Код:
.pwn(5121) : error 052: multi-dimensional arrays must be fully initialized
now i got that error .. and the value for the MAX_GANGS i put 100 ..


Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

Код:
new Float:ZoneLocations[MAX_ZONES][4] = {
 	{2193.39, -1926.622, 2590.068, -1448.945}, 
 	{2010.854, -1448.945, 2590.068, -1058.119},
	{1807.184, -1926.622, 2193.39, -1448.945}, 
	{1075.356, -1885.622, 1424.182, -1390.99}, 
	{2590.068, -1673.966, 2927.337, -1058.119},
	{1424.182, -1885.622, 1807.184, -1448.945}, 
	{2079.305, -2312.000, 2547.053, -1926.622},
	{1424.182,-1448.945,1862.935,-1044.718}, 
	{765.8739, -1885.622, 1075.356, -1390.99}, 
	{2374.551,-2677.546,2847.865,-2312.000}, 
	{2547.053, -2312.000, 2927.337, -1926.622}, 
	{1862.935,-1448.945,2010.854,-1044.718}, 
	{765.8739, -1390.99, 1075.356, -1044.718}, 
	{1075.356, -1390.99, 1424.182, -1044.718} 
};
And why i got it ? and one thing .. i used only a half of those zone locations... and
Код:
};
was the lihe where the error was


Re: why did this happen ? i cant fix it ? - Miguel - 25.02.2010

Quote:
Originally Posted by DaRulz
b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 12 hours old. (this means you cannot post twice yourself, use the "modify" buttom)
And please, you could've solved your errors by searching a bit and learning. So, search for "multi-dimensional arrays must be fully initialized".

Anyway, my fix would be:
pawn Код:
new Float:ZoneLocations[][] = {
    {2193.39, -1926.622, 2590.068, -1448.945},
    {2010.854, -1448.945, 2590.068, -1058.119},
    {1807.184, -1926.622, 2193.39, -1448.945},
    {1075.356, -1885.622, 1424.182, -1390.99},
    {2590.068, -1673.966, 2927.337, -1058.119},
    {1424.182, -1885.622, 1807.184, -1448.945},
    {2079.305, -2312.000, 2547.053, -1926.622},
    {1424.182,-1448.945,1862.935,-1044.718},
    {765.8739, -1885.622, 1075.356, -1390.99},
    {2374.551,-2677.546,2847.865,-2312.000},
    {2547.053, -2312.000, 2927.337, -1926.622},
    {1862.935,-1448.945,2010.854,-1044.718},
    {765.8739, -1390.99, 1075.356, -1044.718},
    {1075.356, -1390.99, 1424.182, -1044.718}
};
Ohh, and remember to change:
pawn Код:
#define MAX_ZONES 100 // change 100 to 14, because there are just 14 zones



Re: why did this happen ? i cant fix it ? - AlbanianGuy - 25.02.2010

no mistakes this time .. thank you !