I made an socket script so mIRC have the function of an unreal IRCD but now if we put an 100 clone's on it and let them quit irc will crash.

I use this ident for the QUIT command from the user:
Code:
  .if ($1 == QUIT) {
    .stop_user $sockname $2-
    .halt
  }


and this is the alias:

Code:
alias stop_user {
  var %nick[quit] = $gettok($1,2,58)
  var %hash[quit] = $gettok($1,3,58)
  .if ($hget(%hash[quit],channel)) {
    var %quit[loop] = 0
    .hdel $hget(%hash[quit],channel) $1
    while (%quit[loop] < $hget($hget(%hash[quit],channel),0).item) {
      .inc %quit[loop]
      .if ($1 == $2) {
        .sockwrite -n $hget($hget(%hash[quit],channel),%quit[loop]).item : $+ %nick[quit] $+ ! $+ $hget(%hash[quit],ident) $+ @ $+ $sock($1).ip QUIT : $+ $3-
      }
      .else {
        .sockwrite -n $hget($hget(%hash[quit],channel),%quit[loop]).item : $+ %nick[quit] $+ ! $+ $hget(%hash[quit],ident) $+ @ $+ $sock($1).ip QUIT :QUIT: $2-
      }
    }
    .hdel %hash[quit] channel
    .hfree %hash[quit]
    .sockclose $1
    .halt
  }
  .halt
}

but irc crasht on this kind of script.