if {($opmecom == "") && ([matchattr $hand omnpcbt]) || ([matchattr $hand omnpcbt $chan] == 1) && ([string match #* $arg] == 0)} {
set copc 0
foreach c [channels] {
if {[onchan $nick $c]} {
pushmode $c +o $nick
incr copc
}
}
if {$copc} {
puthelp "NOTICE $nick :** Opped you on $copc channels."
}
}
OK - A couple of issues after fixing this.
You should read up on what each global, and channel user flag is.
Matching against "omnpcbt" as the flags is not very secure. +t flag - This means that a botnet master (some1 witht he rights to link bots, not gain ops).
Note, you state, that the user should have either channel flags, or global flags to gain OPS in all channels. This means, that some1 who has been given channel OP's in one channel, can gain OP's in another channel, regardless of his flags.