I've done this, before:
LOCKADD-CMD: $+llock/add *=*:@switch/first 0= isdbref(setr(0, locate(%#, secure(%0), eV))), {@pemit %#=GAME> '[secure(%0)]' doesn't seem to be a proper exit. }, or(controls(%#, %q0), match(get(%q0/LOCK-LIST), %#)), {@pemit %#=GAME> You don't control '[name(%q0)]'. }, and(hasattr(%q0, LOCK-LIST), hasattr(%q0, OTHERSIDE), match(lock(%q0), #0&!#0)), {@pemit %#=GAME> [name(%q0)] hasn't been +llocked or is currently unlocked. Please wait 60 seconds without using the exit in any way and try it again. }, isdbref(setr(1, pmatch(secure(%1)))), {@pemit %#=GAME> '[secure(%1)]' doesn't seem to be a player. }, {@pemit %#=GAME> You add [name(%q1)] to the +llock for [name(%q0)] ;&LOCK-LIST [u(%q0/OTHERSIDE)]=setunion(u(%q0/LOCK-LIST), %q1) ;&LOCK-LIST %q0=setunion(u(%q0/LOCK-LIST), %q1) }
LOCKSUB-CMD: $+llock/rem *=*:@switch/first 0= isdbref(setr(0, locate(%#, secure(%0), eV))), {@pemit %#=GAME> '[secure(%0)]' doesn't seem to be a proper exit. }, controls(%#, %q0), {@pemit %#=GAME> You don't control '[name(%q0)]'. }, and(hasattr(%q0, LOCK-LIST), hasattr(%q0, OTHERSIDE), match(lock(%q0), #0&!#0)), {@pemit %#=GAME> [name(%q0)] hasn't been +llocked or is currently unlocked. Please wait 60 seconds without using the exit in any way and try it again. }, isdbref(setr(1, pmatch(secure(%1)))), {@pemit %#=GAME> '[secure(%1)]' doesn't seem to be a player. }, {@pemit %#=GAME> You remove [name(%q1)] from the +llock for [name(%q0)] ;&LOCK-LIST [u(%q0/OTHERSIDE)]=setdiff(u(%q0/LOCK-LIST), %q1) ;&LOCK-LIST %q0=setdiff(u(%q0/LOCK-LIST), %q1) }
LOCKUN-CMD: $+unllock *:@switch/first 0= isdbref(setr(0, locate(%#, secure(%0), eV))), {@pemit %#=GAME> '[secure(%0)]' doesn't seem to be a proper exit. }, controls(%#, %q0), {@pemit %#=GAME> You don't control '[name(%q0)]'. }, and(hasattr(%q0, LOCK-LIST), hasattr(%q0, OTHERSIDE), match(lock(%q0), #0&!#0)), {@pemit %#=GAME> [name(%q0)] hasn't been +llocked or is currently unlocked. Please wait 60 seconds without using the exit in any way and try it again. }, {@halt %q0 ;@halt [u(%q0/OTHERSIDE)] ;@pemit owner(me)=GAME> %n +unllock-ed [name(%q0)] <%q0>. Thus the @halts. ;@pemit %#=GAME> You clear the +llock code off of [name(%q0)]. ;@dolist Afail Asucc Fail Use Ause={@wipe %q0/## ;@wipe [u(%q0/OTHERSIDE)]/## } ;@unlock %q0 ;@unlock [u(%q0/OTHERSIDE)] ;@set %q0=!QUIET !HALTED ;@set [u(%q0/OTHERSIDE)]=!QUIET !HALTED }
LOCKCHK-CMD: $+llock/check *:@switch 0 = isdbref(setr(0, locate(%#, secure(%0), eV))), {@pemit %# = GAME> No such exit.}, or(hasflag(%q0, VISUAL), controls(%#, %q0)), {@pemit %#=GAME> You don't control that exit.}, and(hasattr(%q0, LOCK-LIST), hasattr(%q0, OTHERSIDE), match(lock(%q0), #0&!#0)), {@pemit %#=GAME> [name(%q0)] hasn't been +llocked or is currently unlocked. Please wait 60 seconds without using the exit in any way and try it again. }, {@pemit %#=GAME> [itemize(sort(iter(get(%q0/LOCK-LIST), name(##), %b, |), i, |, |), |)] can open the '[name(%q0)]' exit.}
+llock <exit name>
+llock/add <exit>=<name>
+llock/rem <exit>=<name>
+llock/check <exit>
+unllock <exit>
These commands can be used to lock a door you OOCly own. The first command sets the code in place. Once set up, your attempting to go through the exit will unlock the door. Going through it will make it wait a RL minute and then re-lock itself (both sides). You only need to set up the code on one 'side' of a door and it'll take care of the other side by itself. If you want to open the door for someone who wants to come in, just try to leave once and that'll unlock it for them. You can also 'use' the exit (EG: 'use out') to unlock it for a minute.
The second and third commands can add or remove other folks from the list of people who will be able to unlock the door. The fourth command checks whom the exit is currently accessible by.
The last command strips the +llock code from an exit (making it unlocked for everyone). Don't forget the weird double 'L' in there. Note that this is -not- the command to let someone through (that'd be either +llock/add if you want them to have access forevermore, or you can just 'use' the exit to unlock it).