28.03.2014, 11:42
Hola primeramente tengo este cуdigo:
lo que sucede es quй cuando utilizo:
EnZonaSegura(playerid)
siempre retorna 0 y estoy en la zona, lose porquй tambien las hice con gangzones:
Alguna idea de porquй no funciona?
La utilizo asi:
pero siempre retorna 0
pawn Код:
IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
return 1;
}
return 0;
}
stock EnZonaSegura(playerid)
{
if(IsPlayerInArea(playerid, 1827.987, -1449.987, 1715.987, -1323.987 ) == 1 ||
IsPlayerInArea(playerid, 2245.995, -1215.599, 2175.995, -1145.599 ) == 1 ||
IsPlayerInArea(playerid, 1100.171, -1994.005, 1296.171, -2078.005 ) == 1 ||
IsPlayerInArea(playerid, 1297.161, -831.044, 1227.161, -775.044 ) == 1 ||
IsPlayerInArea(playerid, 156.809, 1945.068, 282.809, 1833.068 ) == 1 ||
IsPlayerInArea(playerid, -1889.145, 351.053, -2001.145, 589.053 ) == 1 ||
IsPlayerInArea(playerid, 2888.435, 844.508, 2776.435, 1012.508 ) == 1 ||
IsPlayerInArea(playerid, 2736.047, -1069.794, 2624.047, -1167.794 ) == 1 ||
IsPlayerInArea(playerid, 2437.847, -1628.469, 2535.847, -1726.469 ) == 1 )
{
return 1;
}
return 0;
}
EnZonaSegura(playerid)
siempre retorna 0 y estoy en la zona, lose porquй tambien las hice con gangzones:
pawn Код:
SZ1 = GangZoneCreate( 1827.987, -1449.987, 1715.987, -1323.987 );
SZ2 = GangZoneCreate( 2245.995, -1215.599, 2175.995, -1145.599 );
SZ3 = GangZoneCreate( 1100.171, -1994.005, 1296.171, -2078.005 );
SZ4 = GangZoneCreate( 1297.161, -831.044, 1227.161, -775.044 );
SZ5 = GangZoneCreate( 156.809, 1945.068, 282.809, 1833.068 );
SZ6 = GangZoneCreate( -1889.145, 351.053, -2001.145, 589.053 );
SZ7 = GangZoneCreate( 2888.435, 844.508, 2776.435, 1012.508 );
SZ8 = GangZoneCreate( 2736.047, -1069.794, 2624.047, -1167.794 );
SZ9 = GangZoneCreate( 2437.847, -1628.469, 2535.847, -1726.469 );
La utilizo asi:
pawn Код:
if(EnZonaSegura(playerid) == 1)
{
//ejecutar funcion
}