I would just like to point out that the parser will run your if-then-else statements much quicker if you group your comparisons with more brackets, ie:
if ((this) || (that)) { DO }
is quicker than:
if (this || that) { DO }
You don't need your 'halt' statements. In fact, since you are '/whoising' people, you may want to use 'haltdef' to halt the response the IRC server gives you, since you don't want your window flooded every time you '/whois' for a mask.
Here is an 'example' rework that you may use if you want:
on *:Text:!unban *:#:{
if (($nick isop $chan) || ($nick ishop $chan)) { .enable #banunban | who $2 | set %ban_var $chan -b $2 }
else { .notice $nick Sorry, you need to be at least halfop to use this command. }
}
on *:Text:!ban *:#:{
if (($nick ishop $chan || $nick isop $chan)) { .enable #banunban | who $2 | set %ban_var $chan +b $2 }
else { .notice $nick Sorry, you need to be at least halfop to use this command. }
}
#banunban off
raw 315:*:.disable #banunban | .mode $gettok(%ban_var,1,32) $gettok(%ban_var,2,32) $address($gettok(%ban_var,3,32),2) | haltdef
raw 352:*:haltdef
#banunban end