The easier way IMHO is to create 2 config files on your server like such:
#1
Filename: lock.cfg
File contents: sv_password "pass"
#2
Filename: unlock.cfg
File contents: sv_password ""
then you can simply use your amx_cfg access (flag H) to run either config and the appropiate action is taken.
This is the best thing for my..shall we say less experienced AMXX Admins, because they can lock/unlock the server very easily and do not need rcon access nor to nag me to do it. I also do it this way quite a lot because I am just plain lazy
.