Give it a try:

Code:
on *:text:!code:#:{
  if (%occupied == 0) || (!%occupied) {
    set %occupied 1
    set %nick $nick
    set %chan $chan
    set %code $read(code.txt)
    msg $chan Security code: %code
    .timercode 1 10 /timeout
    .enable #codecheck
  }
  else msg $chan $nick bot is already working ;)
}
#codecheck off
on *:text:&:#:{
  if ($nick == %nick) {
    if ($1 == %code) {
      msg $chan code confirmed
      set %occupied 0
      timercode off
    }
    else {
      msg $chan %nick $+ , $1 $+ : wrong code
      msg $chan %nick repeat operation
      set %occupied 0
      timercode off
    }
    .disable #codecheck
  }
}
#codecheck end
alias -l /timeout {
  set %occupied 0
  msg %chan %nick $+ , time out, sorry
  msg %chan %nick repeat operation 
  .disable #codecheck
}  


You can change any part to make it work as you want.