21.07.2009, 08:28
pawn Code:
#define MAX_ZONES 100
enum gzinfo
{
Float:gmaxX,
Float:gmaxY,
Float:gminY,
Float:gminX,
};
new Zone[MAX_ZONES][gzinfo];
new LastZone = 0;
GangZoneCreate2(Float:minx, Float:miny, Float:maxx, Float:maxy)
{
GangZoneCreate(minx,miny,maxx,maxy);
Zone[LastZone][gminX]=minx;
Zone[LastZone][gminY]=miny;
Zone[LastZone][gmaxX]=maxx;
Zone[LastZone][gmaxY]=maxy;
LastZone++;
return 1;
}
IsPlayerInGangZone(playerid,gangzoneid)
{
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if( Pos[0] >= Zone[gangzoneid][gminX] && Pos[0] <= Zone[gangzoneid][gmaxX] && Pos[1] >= Zone[gangzoneid][gminY] && Pos[1] <= Zone[gangzoneid][gmaxY] ) return 1;
else return 0;
}
GetPlayerZone(playerid)
{
for( new g=0; g<MAX_ZONES; g++)
{
if( IsPlayerInGangZone(playerid, g) )
{
return Zone[g][gzinfo]; /*error*/
}
}
return -1;
}
pawn Code:
error 032: array index out of bounds (variable "Zone")