Keon191, the code you've posted is what we call it a pseudo code. (at least for the upper part of your text event) It's an informal mock-up of description in a scripting language. You can post this in a scripting tutorial section of the forum. A submitted snippet should be fully functional.
WorldDMT is French, so his English may sometimes get you mistaken for something else. :p
SunnyD, his regex, as you can see, is sort of redundant. It can be improved as such:
on $@*:text:/^!ucmd o(n|ff)$/iS:#:{
Then use > if $regml(1) == n { and > if $regml(1) == ff { to reference the regex matches.
P.S. His script can further be refined to check whether it's already turned on or off, rather than just for the on switch. A trigger control may be needed in case of spam or flood.