So I can add new people to the list, but when I try to leave the list it doesn't actually save the file that I left. It's like it's not overwriting the file so that the key that left the table is gone.

Code:
on *:TEXT:-list*:#: { 
  hload -i list List.ini IGNs
  if ($2 == join) {
    if ($4) || ($len($3) <= 3) || ($len($3) >= 25) {
      msg $chan $nick make sure your IGN is written without spaces.
    }
    else if ($3) {
      if ( $hget(list, $nick) > 0) {
        msg $chan $nick is already on the list as $hget(list, $nick) .
      }
      else if ( $hfind(list, $3, 1).data > 0) {
        msg $chan $3 was already put on the list by $hfind(list, $3, 1).data .
      }
      else {
        hadd list $nick $3
        
        hsave -i list List.ini IGNs
        msg $chan $nick $3 joins the list ( $chr(35) $hget(list, 0).item ) as $3 .
      }
    }
  }
  elseif ($2 == leave) {
    if ( $hget(list, $nick) > 0) {
      msg $chan $nick ( IGN: $hget(list, $nick) ) leaves the list.
      hdel -sw list $nick
      hsave -i list List.ini IGNs
    }
  }
}



I also have some questions aside from it not saving the key being removed. I also can't find a way to look for a value (not key) and return the key associated with it. I'd also like to know if there's a simple command for returning the number of keys in the table.

Last edited by Gotex007; 13/12/13 08:21 AM. Reason: (I've edited to update with the changes made to the code)