What do you mean by "not working"? Is there an error message?
If you can type the command but pressing enter does nothing (the command stays in the input field) when playing online, it usually means that either you lost connection to the server, or the server isn't accepting commands because some script is in an infinite loop.