All pastes #456309 Raw Edit

Stuff

public text v1 · immutable
#456309 ·published 2007-04-24 19:26 UTC
rendered paste body
on *:LOAD:{
  /set %NumberChansKnC 0
  /set %NumberChansmTLK 0
}

alias addtoarray {
  /searcharray
  if (%ChanCheckKnC == true) {
    /notice $me This channel is already being mirrored to
  }
  else {
    /inc %NumberChansKnC 1
    /set %country [ $+ [ %NumberChansKnC ] ] $chan
    /notice $me Mirroring to channel $chan is turned on
  }
}

alias -l searcharray {
  /var %counter 1
  /set %ChanCheckKnC false
  while (%counter <= %NumberChansKnC) {
    if (%country [ $+ [ %counter ] ] == $chan) {
      /set %indexKnC %counter
      /set %ChanCheckKnC true
    }
    /inc %counter 1
  }
}

alias delfromarray {
  /searcharray
  if (%ChanCheckKnC == false) {
    /notice $me This channel issn't on the list so can't be deleted
  }
  else {
    while (%indexKnC < %NumberChansKnC) {
      %country [ $+ [ %indexKnC ] ] = %country [ $+ [ %indexKnC + 1 ] ]
      /inc %indexKnC 1
    }
    /unset %country [ $+ [ %NumberChansKnC ] ]
    /dec %NumberChansKnC 1
    /notice $me Mirroring to channel $chan is turned off
  }
}