Use this as the switch's AI Main script;
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=languagebank\english\gamecore\text\requirescodetoopen.tga,hudname=usecodeprompt,hudhide=1,hudmake=display,state=10
:plrdistwithin=50:hudshow=usecodeprompt,hudfadeout=usecodeprompt
:state=10,plrdistwithin=50,scancodekeypressed=81:state=11,sound=audiobank\switches\press.wav
:state=11,plrdistwithin=50,scancodekeypressed=77:state=12,sound=audiobank\switches\press.wav
:state=12,plrdistwithin=50,scancodekeypressed=79:state=13,sound=audiobank\switches\press.wav
:state=13,plrdistwithin=50,scancodekeypressed=72:state=14,sound=audiobank\switches\press.wav
:state=14:state=1,plrsound=$0,activateifused=1,alttexture=1
:state=1,plrusingaction=0:state=2
:state=2,plrdistwithin=50,plrusingaction=1:state=3,plrsound=$1,activateifused=0,alttexture=0
:state=3,plrusingaction=0:state=10
Make sure that the switch's 'if used' points to the door you're using, and the door has the same name as in the 'if used' field. I know that sounds obvious, but I've made that mistake myself!!
Also change the scancodes to whatever keys are used to open the door.