id = button id in OpsSetup dialog IE: 3

if dialog is open use

on *:op:#: { if ($opnick == $me) { did -e OpsSetup ID } }
on *:deop:#: { if ($opnick == $me) { did -b OpsSetup ID } }


but you may need to add if not open
on *:DIALOG:OpsSetup:init:0:{
if ($me isop #channel) { did -e OpsSetup ID }
if ($me !isop #channel) { did -b OpsSetup ID }
}

pretty new to this hope it helps

or to totally hide the button use -h
and to make it visible again -v