i dont know whats behind the code, but IMO you ll need new instance/variable adopting previous percentage on each moment player entering/leaving the zone and rate calculated for amount of players at this moment
(1 Player in zone ~ P:=P+1=1) Lets say, player P1 is entering zone Z at time t1=0:00~ 0 minutes, then timer T1=0% and rate R1=1/3600% added to T1 each second.
(2 Players in zone ~ P:=P+1=2): If any of players(P2) from same faction is entering zone Z at the time t2=10:00,~ 10,00 minutes, then T2=T1+R1*60*(t2-t1) = 0+1/3600*60*(10,00-0,00)=16,66%, rate becomes R2=2/3600% added to T2 each second.
(3 Players in zone ~ P:=P+1=3): If third player(P3) is entering zone Z at the the time t3=15:00 ~ 15,00 minutes, then T3=T2+R2*60*(t3-t2)=16.66+2/3600*60*(15,00-10,00)=33,33%, rate becomes ofc R3=3/3600% added to T3 each second.
(4 Players in zone ~ P:=P+1=4): If next player P4 is entering Z at the time t4=18:20~ 18,33 ~ T4=T3+R3*60*(t4-t3)=33,33+3/3600*60*(18,33-15,00)=50%, rate becomes R4=4/3600% added to T4 each second.
Now consider player leaving/dieing in zone Z:
(3 Players in zone ~ P:=P-1=3): Player P4 has died/left zone Z at the time t5=20:50 ~ T5=T4+R4*60*(t5-t4)=50+4/3600*60*(20,83-18,33)=66,66%, rate becomes R5=R3=3/3600% added to T5 each second.
.
.
.
Now consider reaching player limit of zonecontrol (P:=0 or P:=7)
MIN
(0 Players in zone ~ P:=P-1=0): Player PX has left/died in zone Z at the time tX<60 minutes minutes, then TX<100%, rate becomes RX=R0=0/3600% ,Zone control stops, zone Z belongs to previous faction.
MAX
(7 Players in zone ~ P:=P+1=7): Player PY has entered zone Z at the time tY<60 minutes, then TY<100%, rate is not changed RY=R6=6/3600% still added to TY each second.
Actual timer T evaluation
Consider each entering/leaving player counter C, so everytime player leaves, dies or enters zone Z,counter becomes C:=C+1, then timer T evaluation is
T=TC+RC*60*(t-tC)
where:
T is actual timer since the begining of ZC [%]
t is actual timer since the begining of ZC[minutes]
TC is time of last player entry/leave [%]
tC is time of player entry/leave [minutes]
RC is rate determined by last player entry {0/3600...6/3600} [%]
Succesful ZC:
If timer reaches 100%(T>=100%), ZC stops, zone Z belongs to faction of players P.