A few comments:
\" elseif ($me isop #) {\" <- you can replace this with \"else {\" since you already said in the If statement that if you are not an op.
Also make the variables local instead of global so you don\'t have to unset it.