Detecting time.
#1

Hello , i have a turf system but i want to detect time . If the zone was attack last time before 1 min ago so he get message this zone was attack 1 min ago and if the zone was attack 2 min ago so he get the message this zone was attack 2 min ago.
Following is my command of on entering Zone.
PHP код:
forward ZoneTimer();
public 
ZoneTimer()
{
    for(new 
i=0sizeof(ZoneInfo); i++) // loop all zones
    
{
        if(
ZoneAttacker[i] != -1// zone is being attacked
        
{
            if(
GetPlayersInZone(iZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR// team has enough members in the zone
            
{
                
ZoneAttackTime[i]++;
                if(
ZoneAttackTime[i] == TAKEOVER_TIME// zone has been under attack for enough time and attackers take over the zone
                
{
                    
GangZoneStopFlashForAll(ZoneID[i]);
                    
ZoneInfo[i][zTeam] = ZoneAttacker[i];
                    
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
                    
ZoneAttacker[i] = -1;
                }
            }
            else 
// attackers failed to take over the zone
            
{
                
GangZoneStopFlashForAll(ZoneID[i]);
                
ZoneAttacker[i] = -1;
            }
        }
        else 
// check if somebody is attacking
        
{
            for(new 
t=0sizeof(Teams); t++) // loop all teams
            
{
                if(
Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(iTeams[t]) >= MIN_MEMBERS_TO_START_WAR// if there are enough enemies in the zone
                
{
                    
ZoneAttacker[i] = Teams[t];
                    
ZoneAttackTime[i] = 0;
                    
GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
                }
            }
        }
    }

Reply


Messages In This Thread
Detecting time. - by Arxalan - 20.01.2015, 05:28
Re: Detecting time. - by Threshold - 20.01.2015, 08:09
Re: Detecting time. - by Facerafter - 20.01.2015, 09:34

Forum Jump:


Users browsing this thread: 1 Guest(s)