Capture Zones
#1

Ok i made this capture zone thing but the issue is when the player enters the checkpoint and then leaves without completeing the capture , the checkpoint continues to flash... Also when they enter a checkpoint , it disappears and will not create again



PHP код:
public OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == CP[Idlewood])
    {
        if(
UnderAttack[Idlewood] == 1)
        {
            
SendClientMessage(playeriderror,"This zone is already being captured!");
        }
        if(
gTeam[playerid] == tCP[Idlewood])
        {
            
SendClientMessage(playeriderror,"Your team already owns this turf!");
        }
        else if(
gTeam[playerid] == NONE)
        {
            
SendClientMessage(playeriderror,"You have no team so you cannot capture!");
        }
        else
        {
           
UnderAttack[Idlewood] = 1;
           
timer[playerid][Idlewood] = SetTimerEx("SetCaptureZone"25000false,"i",playerid);
           
CountTime[playerid] = SetTimerEx("tCountDown"1false,"i"playerid);
           
iCP[playerid] = Idlewood;
           
InCP[playerid][Idlewood] = 1;
           
Captured[Idlewood] = 0;
           if(
gTeam[playerid] == GROVE)
           {
               
GangZoneFlashForAll(Zone[Idlewood], gcol);
           }
           else if(
gTeam[playerid] == BALLAS)
           {
               
GangZoneFlashForAll(Zone[Idlewood], bcol);
           }
           else if(
gTeam[playerid] == AZE)
           {
               
GangZoneFlashForAll(Zone[Idlewood], acol);
           }
           else if(
gTeam[playerid] == VIPS)
           {
               
GangZoneFlashForAll(Zone[Idlewood], vipcol);
           }
           new 
string[128];
              
format(stringsizeof(string),"%s is trying to capture Idlewood Gas Station",GetName(playerid));
           
SendClientMessageToAll(-1string);
        }
    }
    if(
checkpointid == CP[Hospital])
     {
        if(
UnderAttack[Hospital] == 1)
        {
            
SendClientMessage(playeriderror,"This zone is already being captured!");
        }
        else if(
gTeam[playerid] == tCP[Hospital])
        {
            
SendClientMessage(playeriderror,"This turf is already being captured!");
        }
        else if(
gTeam[playerid] == NONE)
        {
            
SendClientMessage(playerid,error,"You have no team so you cannot capture!");
        }
        else
        {
           
UnderAttack[Hospital] = 1;
           
timer[playerid][Hospital] = SetTimerEx("SetCaptureZone"25000false,"i",playerid);
           
CountTime[playerid] = SetTimerEx("tCountDown"1false,"i"playerid);
           
iCP[playerid] = Hospital;
           
InCP[playerid][Hospital] = 1;
           
Captured[Hospital] = 0;
           new 
string[128];
           
format(stringsizeof(string),"%s is trying to capture the Hospital",GetName(playerid));
           
SendClientMessageToAll(-1string);
        }
    }
public 
OnPlayerLeaveDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == CP[Idlewood])
    {
        if(
Captured[Idlewood] == 1)
        {
            
GangZoneStopFlashForAll(Zone[Idlewood]);
            
UnderAttack[Idlewood] = 0;
            
InCP[playerid][Idlewood] = 0;
            
tCP[Idlewood] = gTeam[playerid];
            if(
gTeam[playerid] == GROVE)
            {
                
GangZoneShowForAll(Zone[Idlewood], gcol);
            }
            else if(
gTeam[playerid] == BALLAS)
            {
                
GangZoneShowForAll(Zone[Idlewood], bcol);
            }
            else if(
gTeam[playerid] == AZE)
            {
                
GangZoneShowForAll(Zone[Idlewood], acol);
            }
            else if(
gTeam[playerid] == VIPS)
            {
                
GangZoneShowForAll(Zone[Idlewood], vipcol);
            }
            
KillTimer(timer[playerid][Idlewood]);
            
KillTimer(CountTime[playerid]);
        }
    }
    else if(
Captured[Idlewood] == 0)
    {
        
SendClientMessage(playeriderror,"You have failed to capture this zone!");
        
UnderAttack[Idlewood] = -1;
        
InCP[playerid][Idlewood] = 0;
        
GangZoneStopFlashForAll(Zone[Idlewood]);
        
KillTimer(timer[playerid][Idlewood]);
        
KillTimer(CountTime[playerid]);
      }
    if(
checkpointid == CP[Hospital])
    {
        if(
Captured[Hospital] == 1)
        {
            
GangZoneStopFlashForAll(Zone[Hospital]);
            
UnderAttack[Hospital] = 0;
            
InCP[playerid][Hospital] = 0;
            
tCP[Hospital] = gTeam[playerid];
            if(
gTeam[playerid] == GROVE)
            {
                
GangZoneShowForAll(Zone[Hospital],gcol);
            }
            else if(
gTeam[playerid] == BALLAS)
            {
                
GangZoneShowForAll(Zone[Hospital], bcol);
            }
            else if(
gTeam[playerid] == AZE)
            {
                
GangZoneShowForAll(Zone[Hospital], acol);
            }
            else if(
gTeam[playerid] == VIPS)
            {
                
GangZoneShowForAll(Zone[Hospital], vipcol);
            }
            
KillTimer(timer[playerid][Hospital]);
            
KillTimer(CountTime[playerid]);
        }
        else if(
Captured[Hospital] == 0)
        {
            
SendClientMessage(playeriderror,"You have failed to capture this zone!");
            
UnderAttack[Hospital] = 0;
            
InCP[playerid][Hospital] = 0;
            
GangZoneStopFlashForAll(Zone[Hospital]);
            
KillTimer(timer[playerid][Hospital]);
            
KillTimer(CountTime[playerid]);
           }
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)