Help with errors
#1

Can someone help me out with this please?
pawn Код:
D:\GTA SA\new rp\samp03z_svr_R1_win32\gamemodes\New.pwn(13298) : error 032: array index out of bounds (variable "gSAZones")
D:\GTA SA\new rp\samp03z_svr_R1_win32\gamemodes\New.pwn(13302) : error 032: array index out of bounds (variable "gSAZones")
pawn Код:
stock GetPlayer3DZone(playerid)
{
    new zone[32] = "San Andreas";
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    for(new i = 0; i < sizeof(gSAZones); i++)
    {
13298-->        if(x >= gSAZones[i][SAZONE_MAIN][0] && x <= gSAZones[i][SAZONE_MAIN][3]
        && y >= gSAZones[i][SAZONE_MAIN][1] && y <= gSAZones[i][SAZONE_MAIN][4]
        && z >= gSAZones[i][SAZONE_MAIN][2] && z <= gSAZones[i][SAZONE_MAIN][5])
        {
13302-->            strmid(zone, gSAZones[i][SAZONE_MAIN], 0, 28);
            return zone;
        }
    }
    return zone;
}
Reply
#2

Pls show us how you declared gSAZones
Reply
#3

pawn Код:
static const gSAZones[][SAZONE_MAIN] =
what else do you mean?
Reply
#4

pawn Код:
enum MainZone
{
    Zone_Name[28],
    Float:Zone_Area[6]
}
Reply
#5

Well, i ******d it, i found the enum & the decleration xD

Write it like this:

Код:
stock GetPlayer3DZone(playerid)
{
	new zone[32] = "San Andreas";
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
 	for(new i = 0; i < sizeof(gSAZones); i++)
	{
                if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3]
		&& y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4]
		&& z >= gSAZones[i][SAZONE_AREA][2] && z <= gSAZones[i][SAZONE_AREA][5])
		{
		        strmid(zone, gSAZones[i][SAZONE_NAME], 0, 28);
			return zone;
		}
	}
	return zone;
}
Greekz
Reply
#6

Thanks Kaliber that fixed it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)