22.09.2009, 15:37
I added a map system to my game mod, but there is something bugged with z, i don't know what.
But it works with :
What is wrong ?
Код:
enum SAZONE_MAIN {
SAZONE_NAME[28],
Float:SAZONE_AREA[6]
};
static const gSAZones[][SAZONE_MAIN] = {
// NAME AREA (Xmin,Ymin,Zmin,Xmax,Ymax,Zmax)
// LOS SANTOS
{"Blueberry 1", {104.50,-220.10,2.30,349.60,152.20,200.00}},
{"Blueberry", {19.60,-404.10,3.80,349.60,-220.10,200.00}},
{"Commerce 1", {1323.90,-1842.20,-89.00,1701.90,-1722.20,110.90}},
{"Commerce 1a", {1323.90,-1722.20,-89.00,1440.90,-1577.50,110.90}},
{"Commerce 1b", {1370.80,-1577.50,-89.00,1463.90,-1384.90,110.90}},
{"Commerce 2", {1463.90,-1577.50,-89.00,1667.90,-1430.80,110.90}},
{"Commerce 4", {1583.50,-1722.20,-89.00,1758.90,-1577.50,110.90}},
{"Commerce 3", {1667.90,-1577.50,-89.00,1812.60,-1430.80,110.90}},
// ...
};
stock GetPlayerZone(playerid, zone[], len)
{
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]))
{
return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
}
}
return 0;
}
Код:
error 028: invalid subscript (not an array or too many subscripts): "SAZONE_AREA" error 029: invalid expression, assumed zero error 029: invalid expression, assumed zero fatal error 107: too many error messages on one line
Код:
stock GetPlayerZone(playerid, zone[], len)
{
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]))
{
return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
}
}
return 0;
}

