The confusion was in your suggesting to replace if ($nick isop #) with if ($nick isop $chan). These are identical, and it's not what you meant to convey.

The script should be checking if the target is also an op. So if isop were sufficient (it isn't) you would if ($2 isop #) { return }