23.07.2014, 14:40
Bueno, el siguiente cуdigo es lo mбs cуmodo para mн:
Pero tambiйn lo podrнa hacer asн:
Y mi pregunta es: їcuбl cуdigo es el mбs optimizado?
pawn Код:
public DataZoneLoad()
{
// OCEAN_FLATS_ONE 0
ZonesData[MAX_ZONES][X] = -2667.6711;
ZonesData[MAX_ZONES][Y] = -1.9158;
ZonesData[MAX_ZONES][Z] = 6.1328;
ZonesData[MAX_ZONES][MinX] = -2698.7385;
ZonesData[MAX_ZONES][MinY] = 31.7935;
ZonesData[MAX_ZONES][MaxX] = -2610.6067;
ZonesData[MAX_ZONES][MaxY] = -61.6577;
MAX_ZONES++; // HASHBURY 1
ZonesData[MAX_ZONES][X] = -2534.3796;
ZonesData[MAX_ZONES][Y] = -19.8695;
ZonesData[MAX_ZONES][Z] = 16.4288;
ZonesData[MAX_ZONES][MinX] = -2596.1760;
ZonesData[MAX_ZONES][MinY] = -62.7152;
ZonesData[MAX_ZONES][MaxX] = -2509.4551;
ZonesData[MAX_ZONES][MaxY] = 31.2552;
for (new i = 0; i<=MAX_ZONES; i++)
{
ZonesData[i][GangZone] = GangZoneCreate(ZonesData[i][MinX], ZonesData[i][MinY], ZonesData[i][MaxX], ZonesData[i][MaxY]);
ZonesData[i][CheckPoint] = CreateDynamicCP(ZonesData[i][X], ZonesData[i][Y], ZonesData[i][Z], 5.0);
}
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for (new i = 0; i<= MAX_ZONES_COUNT; i++)
{
if (checkpointid == ZonesData[i][CheckPoint])
{
if (ZonesData[i][Attacking] == false &&
ZonesData[i][Owned] != PlayersDataOnline[playerid][Equipo])
{
EnableConquerFromPlayer(playerid, i);
}
}
}
return 1;
}
Pero tambiйn lo podrнa hacer asн:
pawn Код:
public CrearZona(ZonaID, Float:X, Float:Y, Float:Z, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
Territorio[ZonaID][Checkpoint] = CreateDynamicCP(X, Y, Z, 3.0, -1, -1, -1, 100.0);
Territorio[ZonaID][GangZone] = GangZoneCreate(MinX, MinY, MaxX, MaxY);
}
public CargarZonas()
{
CrearZona(OCEAN_FLATS, -2754.4829, -149.8527, 6.9267, -2684.5679, -63.3597, -2814.3396, -210.1641);
CrearZona(CRANBERRY_STATION, -1968.6595, 162.1815, 27.6875, -2017.1252, 218.1302, -1932.3351, 70.2552);
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
switch(checkpointid)
{
case OCEAN_FLATS:
{
if (Territorio[OCEAN_FLATS][Ataque] == false)
{
if (Territorio[OCEAN_FLATS][Dueno] != PlayersDataOnline[playerid][Equipo])
{
ActivarCaptura(playerid, OCEAN_FLATS);
}
}
}
case CRANBERRY_STATION:
{
if (Territorio[CRANBERRY_STATION][Ataque] == false)
{
if (Territorio[CRANBERRY_STATION][Dueno] != PlayersDataOnline[playerid][Equipo])
{
ActivarCaptura(playerid, CRANBERRY_STATION);
}
}
}
}
}
Y mi pregunta es: їcuбl cуdigo es el mбs optimizado?