Timers don't pause/unpause

I’m making a control point system and I’m using timers to determine when a point gets taken. I know this isn’t the most optimized or cleanest code ever, but here’s how I’m working it out.

[lua]
function GM:Think()
local redCount = 0
local blueCount = 0

for k,v in pairs( player.GetAll() ) do
	v:SetNWBool( "InCapture", false )
end

for k,v in pairs( ents.FindInSphere( Vector( -40, -1947, -11032 ), 1000 ) ) do
	if v:IsPlayer() then
		if v:Team() == TEAM_BLUFOR and v:Alive() then
			blueCount = blueCount + 1
			v:SetNWBool( "InCapture", true )
		elseif v:Team() == TEAM_OPFOR and v:Alive() then
			redCount = redCount + 1
			v:SetNWBool( "InCapture", true )
		end
	end
end

timer.UnPause( "RedCapture" )
timer.UnPause( "RedCapture2" )

timer.UnPause( "BlueCapture" )
timer.UnPause( "BlueCapture2" )

if redCount > blueCount then	
	if timer.Exists( "RedCapture" ) then
		timer.Destroy( "BlueCapture" )
		timer.Destroy( "BlueCapture2" )
		SetGlobalInt( "Capture", 3 )
	end
	if GetGlobalInt( "PointOwner" ) != TEAM_OPFOR then
		SetGlobalInt( "Capture", TEAM_OPFOR )
		if not timer.Exists( "RedCapture" ) then
			SetGlobalInt( "CaptureTime", 15 )
			timer.Create( "RedCapture2", 15, 1, function()
				SetGlobalInt( "PointOwner", TEAM_OPFOR )
			end )
			timer.Create( "RedCapture", 1, 15, function()
				SetGlobalInt( "CaptureTime", timer.TimeLeft( "RedCapture2" ) )
				for k,v in pairs( team.GetPlayers( TEAM_OPFOR ) ) do
					v:SetNWBool( "InCapture", false )
				end
			end )
		end
	end
elseif redCount < blueCount then
	if timer.Exists( "RedCapture" ) then
		timer.Destroy( "BlueCapture" )
		timer.Destroy( "BlueCapture2" )
		SetGlobalInt( "Capture", 3 )
	end
	if GetGlobalInt( "PointOwner" ) != TEAM_BLUFOR then
		SetGlobalInt( "Capture", TEAM_BLUFOR )
		if not timer.Exists( "BlueCapture" ) then
			SetGlobalInt( "CaptureTime", 15 )
			timer.Create( "BlueCapture2", 15, 1, function()
				SetGlobalInt( "PointOwner", TEAM_BLUFOR )
			end )
			timer.Create( "BlueCapture", 1, 15, function()
				SetGlobalInt( "CaptureTime", timer.TimeLeft( "BlueCapture2" ) )
				for k,v in pairs( team.GetPlayers( TEAM_BLUFOR ) ) do
					v:SetNWBool( "InCapture", false )
				end
			end )
		end
	end
elseif redCount == blueCount and redCount > 0 and blueCount > 0 then
	print( "Pausing timers..." )
	timer.Pause( "BlueCapture" )
	timer.Pause( "BlueCapture2" )
	timer.Pause( "RedCapture" )
	timer.Pause( "RedCapture2" )
else
	if timer.Exists( "RedCapture" ) then
		timer.Destroy( "RedCapture" )
		timer.Destroy( "RedCapture2" )
	end
	if timer.Exists( "BlueCapture" ) then
		timer.Destroy( "BlueCapture" )
		timer.Destroy( "BlueCapture2" )
	end
	SetGlobalInt( "Capture", 3 )
end

end
[/lua]

If I remove timer.Pause and timer.UnPause it works almost fine, but the timer resets whenever an enemy blocks your capture, which I don’t want. One thing I’ve noticed is printing the output of timer.Pause or timer.UnPause doesn’t seem to return anything. Any ideas as to what I’m doing wrong?

The issue here is calling Pause/UnPause on timers that are already paused/active respectively. Some quick debugging reveals this seems to break the system. This is something that probably needs to be fixed in a future update, but you can get around it by tracking the paused state of all your timers.