Also, if you are typing this in the channel from something other than the "bot" running the script (ie. you're using on TEXT rather than on INPUT for the trigger), then you REALLY need to put a check in to make sure the person using it is allowed to use it.
if ($nick isop $chan) {}
if ($nick == somenick) {}
etc.
Otherwise, anyone can use it to gain ops.