what Jethro_ meant by saying "Why do you use many checks for op and halfop?"
is you have
if ($nick isop $chan) || ($nick ishop $chan) {
everywhere when you could have done one or maybe two seeing how you have the code
and instead of doing the check like this
if ($nick isop $chan) || ($nick ishop $chan) {
you could do it like this
if ($nick(#,$nick,oh)) {
but whatever to each their own......