Nothing wrong with that code.
yes there is, unless you have ops already you cant get ops? that makes no sense.
How can someone type text in a channel if they arent in the channel? If you dont have the channel mode set to stop that you are wide open to harrassment.
on *:TEXT:!op*:#: {
if ($nick !isop $chan) || ($2 !ison $chan) { halt }
mode $chan +o $2
}
if you have the channel operators added to a user level, lets say 1000
on 1000:text:!op:#yourchannel:{ mode #yourchannel +o $nick }
and
on 1000:text:!deopop:#yourchannel:{ mode #yourchannel -o $nick }
or
on 1000:Text:!botname *:#yourchan:{
if ($$2 == !op) { mode #yourchan +o $nick }
elseif ($$2 == !deop) { mode #yourchan -o $nick }
else { notice $nick you have not requested a valid mode change }
}
or you can read from a text file, an ini file or a hash table to check if the $nick and their address match your ops list