The answer depends on what key you want to detect and whether your why to do it clientside or serverside
Server side you can't truly "detect keys pressed," that's the client's job, but you can modify the functions triggered by them: the method posted above for fire, jet, jump, and crouch; anything else the related serverCmd (serverCmdLight for light)
Clientside, what you should do is add the option as a binding in the controls menu so players can bind whether they want to it. Someone else will need to post a reference on how to do that, or you can find an add-on that does (something that adds a GUI would be a good place to look) as I don't feel like digging through stuff on phone