08.05.2015, 04:50
TenteІ:
PHP код:
forward GlobalTimer();
public GlobalTimer()
{
for (new j=0;j<MAX_TURFS;j++)
{
if(gZonesData[j][ZoneInWar] == false)
{
for (new l = 1; l < MAX_ORGS; l++)
{
if(gZonesData[j][ZoneOwner] != l)
{
new PlayersIn = GetGangPlayersInZone(j,l);
if(PlayersIn >= PLAYERS_REQUIRED && Counted[j] == false)
{
Counted[j] = true;
gZonesData[j][ZonePlayerReqMet][l] += PlayersIn;
}
if(PlayersIn < PLAYERS_REQUIRED)
{
gZonesData[j][ZonePlayerReqMet][l] = 0;
}
if(gZonesData[j][ZonePlayerReqMet][l] >= ZONE_CHECKS)
{
StartWar(j, gZonesData[j][ZoneOwner], l);
return 0;
}
gZonesData[j][ZonePlayerCountEx][l] = PlayersIn;
gZonesData[j][ZonePlayerCount][l] = 0;
}
}
}
Counted[j] = false;
if(gZonesData[j][ZoneInWar])
{
if(gZonesData[j][ZoneWarTimeLeft] > 0)
{
gZonesData[j][ZoneWarTimeLeft]--;
new defenders = gZonesData[j][ZoneOwner];
new attackers = gZonesData[j][ZoneAttacker];
new def_in = GetGangPlayersInZone(j,defenders);
gZonesData[j][ZoneWarPlayers][defenders] = def_in;
gZonesData[j][ZoneWarPoints][defenders] += STAYING_POINTS*def_in;
new atk_in = GetGangPlayersInZone(j,attackers);
gZonesData[j][ZoneWarPlayers][attackers] = atk_in;
gZonesData[j][ZoneWarPoints][attackers] += STAYING_POINTS*atk_in;
}
else
{
TurfWarEnd(j, gZonesData[j][ZoneOwner], gZonesData[j][ZoneAttacker]);
}
}
}
}