[Solved] BNC script problem

Paste Your code(s) here, and state your problem.

[Solved] BNC script problem

Postby Horniibabz » Mon Dec 26, 2011 8:23 pm

Code: Select all
on *:CONNECT: {
  .timercheck 0 3600 idlecheck
}

alias idlecheck {
  .remove bnc\check.txt
  set -u60 %antispam 1
  unset %bnc.*
  set %bnc.check 1
  /msg -sBNC who
}

on *:text:.bncpart*:%outputchan: {
  if (!%antispam) {
    if ($owner($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .msg %outputchan %ctstart ERROR! use like this: .bncpart #channel (ident) %ctstop
      }
      if (!$3) {
        var %x = 1
        while (%x <= $calc($lines(bnc\idents.txt) + 1)) {
          if (%x == $calc($lines(bnc\idents.txt) + 1)) {
            .msg %outputchan %ctstart All idents have parted $2 %ctstop
            break
          }
          sbnc simul $gettok($read(bnc\idents.txt,%x),1,32) part $2
          inc %x
        }
      }
      elseif ($4) {
        var %x = 1
        while (%x <= $calc($numtok($3-,32) + 1)) {
          if (%x == $calc($numtok($3-,32) + 1)) {
            .msg %outputchan %ctstart The idents have parted $2 %ctstop
            break
          }
          if (!$read(bnc\idents.txt,w,$gettok($3-,%x,32) *)) {
            .msg %outputchan %ctstart $gettok($3-,%x,32) is not added as an ident. %ctstop
            inc %x
          }
          else {
            sbnc simul $gettok($3-,%x,32) part $2
            inc %x
          }
        }
      }
      else {
        sbnc simul $3 part $2
        .msg %outputchan %ctstart $3 has parted $2 %ctstop
      }
    }
  }
}

on *:text:.bncjoin*:%outputchan: {
  if (!%antispam) {
    if ($owner($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .msg %outputchan %ctstart ERROR! use like this: .bncjoin #channel (ident) %ctstop
      }
      elseif (!$3) {
        var %x = 1
        while (%x <= $calc($lines(bnc\idents.txt) + 1)) {
          if (%x == $calc($lines(bnc\idents.txt) + 1)) {
            .msg %outputchan %ctstart All idents have joined $2 %ctstop
            break
          }
          sbnc simul $gettok($read(bnc\idents.txt,%x),1,32) join $2
          inc %x
        }
      }
      elseif ($4) {
        var %x = 1
        while (%x <= $calc($numtok($3-,32) + 1)) {
          if (%x == $calc($numtok($3-,32) + 1)) {
            break
          }
          else {
            .timer 1 %x { sbnc simul $gettok($3-,%x,32) join $2 }
            .timer 1 $calc(%x + 3) { joincheck $gettok($3-,%x,32) $2 }
            set -u20 %bnc.join. [ $+ [ $gettok($3-,%x,32) ] ] 1
            inc %x
          }
        }
      }
      else {
        sbnc simul $3 join $2
        .timer 1 3 { joincheck $3 $2 }
        set -u5 %bnc.join. [ $+ [ $3 ] ] 1
      }
    }
  }
}

alias joincheck {
  if (%bnc.join. [ $+ [ $1 ] ]) {
    .msg %outputchan %ctstart $1 did not join $2 %ctstop
  }
  else {
    .msg %outputchan %ctstart $1 joined $2 %ctstop
  }
}

on *:text:.bncblacklist*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      if (!$2 || !$3) {
        .notice $nick %ctstart ERROR! Use like this: .bncblacklist add/del auth/host %ctstop
      }
      elseif ($2 == add) {
        if ($readini(bnc.ini,blacklist,$3)) {
          .notice $nick %ctstart ERROR! $3 is already Blacklisted %ctstop
        }
        else {
          writeini bnc.ini blacklist $3 1
          .msg $chan %ctstart $3 was added to the Blacklist %ctstop
        }
      }
      elseif ($2 == del) {
        if (!$readini(bnc.ini,blacklist,$3)) {
          .notice $nick %ctstart ERROR! $3 is not Blacklisted %ctstop
        }
        else {
          remini bnc.ini blacklist $3
          .msg $chan %ctstart $3 was deleted from the Blacklist %ctstop
        }
      }
    }
  }
}

on *:text:.bncprotect*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .bncprotect ident %ctstop
      }
      elseif (!$readini(bnc.ini,$2,auth)) {
        .notice $nick %ctstart ERROR! $2 is not added %ctstop
      }
      else {
        if ($readini(bnc.ini,$2,protect) == yes) {
          writeini bnc.ini $2 protect no
          .msg $chan %ctstart $2 is NOT protected anymore %ctstop
        }
        else {
          writeini bnc.ini $2 protect yes
          .msg $chan %ctstart $2 is now protected %ctstop
        }
      }
    }
  }
}

on *:text:.bncrequest*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .notice $nick %ctstart ERROR! use like this: .bncrequest on/off (reason) %ctstop
      }
      elseif (%requeststatus == $2) {
        .msg $chan %ctstart Request is already $2 %ctstop
      }
      else {
        set %requeststatus $2
        .msg $chan %ctstart Request is now $2 %ctstop
        if ($2 == on) {
          topic %requestchan %ctstart For help with a Bouncer use: .bnchelp %ctmidt Bot version %version %ctmidt Request: 9ON %ctstop
          unset %requestdetail
        }
        elseif ($2 == off) {
          if (!$3-) {
            topic %requestchan %ctstart For help with a Bouncer use: .bnchelp %ctmidt Bot version %version %ctmidt Request: 4OFF %ctstop
            set %requestdetail See topic!
          }
          else {
            topic %requestchan %ctstart $3- %ctmidt Bot version %version %ctmidt Request: 4OFF %ctstop
            set %requestdetail $3-
          }
        }
      }
    }
  }
}

on *:TEXT:.bnckill*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .bnckill IDENT %ctstop
      }
      elseif (!$readini(bnc.ini,$2,auth)) {
        .notice $nick ERROR! $2 is not added as an ident %ctstop
      }
      else {
        sbnc kill $2
        .notice $nick %ctstart $2 was killed %ctstop
      }
    }
  }
}

on *:text:.bncstatus:%outputchan: {
  if ($admin($nick)) {
    if (!%antispam) {
      set -u60 %antispam 1
      unset %bnc.*
      set %bnc.status 1
      /msg -sBNC who
    }
  }
}

on *:TEXT:.bncmsg*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2 || !$3) {
        .notice $nick %ctstart ERROR! Use like this: .bncmsg IDENT MSG %ctstop
      }
      elseif (!$readini(bnc.ini,$2,auth)) {
        .notice $nick ERROR! $2 is not added as an ident %ctstop
      }
      else {
        set %bnc.msg 1
        sbnc tcl setctx $2 $+ $chr(59) bncreply " %ctstart $3- (Admin: $nick $+ ) %ctstop "
      }
    }
  }
}

on *:TEXT:.bncglobal*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .bncglobal MSG %ctstop
      }
      else {
        sbnc global %ctstart $2- %ctstop
      }
    }
  }
}

on *:part:%MAINCHAN: {
  if ($readini(bnc.ini,$remove($gettok($address($nick,1),1,64),*!*),auth)) {
    sbnc simul $remove($gettok($address($nick,1),1,64),*!*) join $chan
    sbnc tcl setctx $remove($gettok($address($nick,1),1,64),*!*) ; bncreply " %ctstart You are violating Bouncer rules! Stay at %mainchan %ctstop "
  }
}

on *:kick:%mainchan: {
  if ($readini(bnc.ini,$remove($gettok($address($nick,1),1,64),*!*),auth)) {
    sbnc simul $remove($gettok($address($knick,1),1,64),*!*) join $chan
  }
}

on *:TEXT:.bncpass:%REQUESTCHAN: {
  if (!%antispam) {
    if ($3 && $admin($nick)) {
      if (!$readini(bnc.ini,$2,auth)) {
        .notice $nick %ctstart ERROR! That ident is not added %ctstop
      }
      else {
        var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
        sbnc resetpass $2 %randpw
        .msg %outputchan %ctstart BNC 8,1reset %ctmidt Ident: $2 %ctmidt Nick: $3 %ctmidt Auth: $readini(bnc.ini,$3,auth) %ctmidt Host: $remove($address($2,2),*!*@) %ctstop
        .cprivmsg $2 %requestchan Direct link use: $read(bnc\link.txt,3)
        .timer 1 2 { .cprivmsg $3 %requestchan %ctstart Ident: $2 %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
      }
    }
    else {
      set %bnc.reset $nick
      set -u7 %antispam 1
      who $nick n%nar
    }
  }
}

on *:text:.bncidle:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set %antispam 1
      set %bnc.idle 1
      /msg -sBNC who
    }
  }
}

on *:TEXT:.bncwhoami:%REQUESTCHAN: {
  if (!%antispam) {
    set %bnc.whoami $nick
    set -u7 %antispam 1
    who $nick n%nar
  }
}

on *:TEXT:.help*:%outputchan: {
  if (!%antispam) {
    if ($nick !isreg $chan) {
      set -u5 %antispam 1
      if (!$2) {
        .cnotice $nick $chan %ctstart Commands: .bncadd|.bncdel|.bncpass|.bncidle|.bncstatus|.bncglobal|.bncrequest %ctstop
        .cnotice $nick $chan %ctstart --------- .bncblacklist|.bncprotect|.bnckill|.bncmsg|.bncjoin|.bncpart %ctstop
        .cnotice $nick $chan %ctstart For more help use: .help <command> EXAMPLE: .help bncdeny
      }
      else {
        var %x = 1
        while (%x <= $calc($lines(bnc\adminhelp.txt) + 1)) {
          if (%x == $calc($lines(bnc\adminhelp.txt) + 1)) {
            .cnotice $nick $chan %ctstart ERROR! That command does not exist %ctstop
          }
          if ($gettok($read(bnc\adminhelp.txt,%x),1,128) == $2) {
            .cnotice $nick $chan %ctstart $gettok($read(bnc\adminhelp.txt,%x),4,128) %ctstop
            .cnotice $nick $chan %ctstart $gettok($read(bnc\adminhelp.txt,%x),2,128) EXAMPLE: $gettok($read(bnc\adminhelp.txt,%x),3,128) %ctstop
            break   
          }
          inc %x
        }
      }
    }
  }
}

alias -l bnclist {
  var %i = 1
  while (%i <= $lines(bnc\help.txt)) {
    var %bnclist = $addtok(%bnclist,$chr(91) $+ %i $+ $chr(93) $left($gettok($read(bnc\help.txt,%i),1,126),1) $+ $right($gettok($read(bnc\help.txt,%i),1,126),-1) %ctmidt ,32)
    inc %i
  }
  return %bnclist
}

on *:text:.bnchelp*:%requestchan: {
  if (!$2) {
    .cnotice $nick $chan %ctstart Hi $nick $+ , you have got the following options: %ctstop
    .cnotice $nick $chan %ctstart $left($bnclist,-9) %ctstop
    .cnotice $nick $chan %ctstart Write .bnchelp 1/2/3 etc, to get help on that problem. %ctstop
  }
  if ($2 == list) && ($nick isop %requestchan) {
    var %i = 1
    while (%i <= $lines(bnc\help.txt)) {
      .timer 1 %i { .cnotice $nick $chan %ctstart $+ %i $+ / $+  $+ $gettok($read(bnc\help.txt,%i),1,126) $+  %ctstop $gettok($read(bnc\help.txt,%i),2-,126) $+  }
      inc %i
    }
  }
  if ($2 == commands) && ($nick isop %requestchan) {
    .cnotice $nick $chan %ctstart BNC help commands: %ctstop
    .cnotice $nick $chan %ctstart .bnchelp add|del|edit|list|N %ctstop
  }
  if ($2 == edit) && ($nick isop %requestchan) {
    if (!$3) {
      .cnotice $nick ERROR! use like this: .bnchelp edit <N> <NEW TEXT HERE> %ctstop
    }
    if ($3 isnum) {
      if (!$read(bnc\help.txt,$3)) {
        .cnotice $nick $chan %ctstart Could not find $3 in my database. %ctstop
      }
      else {
        .cnotice $nick $chan %ctstart $gettok($read(bnc\help.txt,$3),1,32) was reset and updated to: $chr(91) $+ $3 $+ / $+ $gettok($read(bnc\help,n,$3),1,126) $+ $chr(93) $4- %ctstop
        write -l $+ $readn bnc\help.txt $gettok($read(bnc\help.txt,n,$3),1,126) $+ $chr(126) $+ $4-
      }
    }
  }
  if ($2 == add) && ($nick isop %requestchan) {
    if (!$3) {
      .cnotice $nick $chan ERROR! use like this: .bnchelp add <Headline~New text here> %ctstop
    }
    elseif ($read(bnc\help.txt,w,$gettok($3-,1,126) $+ $chr(126))) {
      .cnotice $nick $chan %ctstart $3 already exists. %ctstop
    }
    else {
      write bnc\help.txt $3-     
      .cnotice $nick $chan %ctstart Successfully added $3 %ctstop
    }
  }
  if ($2 == del) && ($nick isop %requestchan) {
    if (!$3) {
      .cnotice $nick ERROR! use like this: .bnchelp del Nr %ctstop
    }
    if ($3 isnum) {
      if ($3 > $lines(bnc\help.txt)) {
        .cnotice $nick $chan %ctstart There is not that many entries added %ctstop
      }
      else {
        .cnotice $nick $chan %ctstart $gettok($read(bnc\help.txt,$3),1,32) was deleted %ctstop
        $read(bnc\help.txt,$3)
        write -dl $+ $readn bnc\help.txt
      }
    }
  }
  else {
    if ($2 isnum && $read(bnc\help.txt,$2)) {
      .cnotice $nick $chan %ctstart  $+ $2 $+  $+ / $+  $+ $gettok($read(bnc\help.txt,$2),1,126) $+  %ctstop $gettok($read(bnc\help.txt,$2),2-,126)
    }
    else {
      var %x = 1
      var %y = 0
      while (%x <= $lines(bnc\help.txt)) {
        if ($2- isin $gettok($read(bnc\help.txt,n,%x),1,126)) {
          inc %y
          .timer 1 %y .cnotice $nick $chan %ctstart  $+ %x $+  $+ / $+  $+ $gettok($read(bnc\help.txt,n,%x),1,126) $+  %ctstop $gettok($read(bnc\help.txt,n,%x),2-,126)
        }
        inc %x
      }
    }
  }
}

on *:text:.bncadd*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2 || !$3 || !$4) {
        .notice $nick ERROR! Use like this: .bncadd ident nick auth
      }
      elseif ($read(bnc\idents.txt,w,$2 *)) {
        .notice $nick %ctstart ERROR! That ident already exists. %ctstop
      }
      else {
        set -u36000 %rbnc. [ $+ [ $2 ] ] 1
        var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
        sbnc adduser $2 %randpw
        sbnc simul $2 sbnc set realname 7,1 ~ 15Bouncer by #EvilAC 7~
        sbnc simul $2 sbnc set server irc.quakenet.org 6667
        writeini bnc.ini AUTHS $4 $2
        writeini bnc.ini $2 auth $4
        .msg $chan %ctstart BNC 9,1added %ctmidt Ident: $2 %ctmidt Nick: $3 %ctmidt AUTH: $4 %ctmidt Host: $remove($address($3,2),*!*@) %ctstop
        .cprivmsg $3 %requestchan %ctstart Rules: Idle %mainchan - Be AUTH'd and mode +x - Follow Quakenet's Rules - Do NOT get KILLED by S %ctstop
        .cprivmsg $3 %requestchan %ctstart Direct link for connecting to your BNC just paste: $read(bnc\link.txt,3) %ctstop
        .timer 1 2 { .cprivmsg $3 %requestchan %ctstart Ident: $2 %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
      }
    }
  }
}

on *:text:.bncdel*:%REQUESTCHAN,%outputchan: {
  if (!%antispam) {
    if (%requeststatus == on) {
      if ($2 && $admin($nick) && $chan == %outputchan) {
        if ($readini(bnc.ini,$2,auth)) {
          .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $2 %ctmidt Auth: $readini(bnc.ini,$2,auth) %ctmidt Host: $iif($readini(bnc.ini,$2,ip),$readini(bnc.ini,$2,ip),None) %ctmidt Reason: Requestet by Admin %ctstop
          deluser $2 Your Bouncer was deleted by admin: $nick
        }
        else {
          .notice $nick %ctstart ERROR! That ident is not added %ctstop
        }
      }
      else {
        unset %bnc.*
        set %bnc.del 1
        set %bnc.nick $nick
        set -u20 %antispam 1
        who $nick n%nar
      }
    }
    else {
      .notice $nick %ctstart .bncdel is currently disabled (Reason: %requestdetail $+ ) %ctstop
    }
  }
}

on *:text:.Rbnc*:%REQUESTCHAN: {
  if (!%antispam) {
    if (%requeststatus == on) {
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .Rbnc IDENT %ctstop
      }
      elseif ($isbnc($address($nick,2))) {
        .notice $2 %ctstart ERROR! You do not meet the requirements to get a BNC. %ctstop
      }
      elseif ($2 !isalpha) {
        .notice $nick %ctstart ONLY letters a-Z can be in your ident. %ctstop
      }
      elseif ($len($2) > 9) {
        .notice $nick %ctstart Your ident is too long, max 9 characters. %ctstop
      }
      elseif ($readini(bnc.ini,$2,auth)) {
        .notice $nick %ctstart ERROR! That ident is already in use. %ctstop
      }
      else {
        unset %bnc.*
        set %bnc.rbnc 1
        set %bnc.nick $nick
        set -u20 %antispam 1
        set -u20 %bnc.ident $2
        .msg -sBNC vhosts
      }
    }
    else {
      .notice $nick %ctstart .rBNC is currently disabled (Reason: %requestdetail $+ ) %ctstop
    }
  }
}

alias deluser {
  sbnc tcl setctx $1 ; bncreply " %ctstart $2- %ctstop "
  sbnc deluser $1
  if ($readini(bnc.ini,$1,auth)) { remini bnc.ini AUTHS $readini(bnc.ini,$1,auth) }
  if ($readini(bnc.ini,$1,ip)) { remini bnc.ini IPS $readini(bnc.ini,$1,ip) }
  if ($1) { remini bnc.ini $1 }
}

raw 354:*: {
  /haltdef
  if (%bnc.whoami) {
    if ($3 == 0) {
      .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .bncwhoami %ctstop
    }
    elseif ($readini(bnc.ini,auths,$3)) {
      .notice $2 %ctstart Your have a Bouncer %ctmidt Ident: $readini(bnc.ini,auths,$3) %ctmidt Auth: $3 %ctstop
    }
    else {
      .notice $2 %ctstart ERROR! You do not have a bouncer %ctstop
    }
  }
  if (%bnc.reset) {
    if ($3 == 0) {
      .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .bncpass %ctstop
    }
    elseif ($readini(bnc.ini,auths,$3)) {
      var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
      sbnc resetpass $readini(bnc.ini,auths,$3) %randpw
      .msg %outputchan %ctstart BNC 8,1reset %ctmidt Ident: $readini(bnc.ini,auths,$3) %ctmidt Nick: $2 %ctmidt Auth: $3 %ctmidt Host: $remove($address($2,2),*!*@) %ctstop
      .cprivmsg $2 %requestchan Direct link use: $read(bnc\link.txt,2)
      .timer 1 2 { .cprivmsg $2 %requestchan %ctstart Ident: $readini(bnc.ini,auths,$3) %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
    }
    else {
      .notice $2 %ctstart ERROR! You do not have a bouncer %ctstop
    }
  }
  if (%bnc.del) {
    if ($readini(bnc.ini,blacklist,$3)) {
      ban -k %requestchan $2 1 %ctstart Black Listed %ctstop
    }
    elseif ($3 == 0) {
      .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .bncdel %ctstop
    }
    elseif (!$readini(bnc.ini,auths,$3)) {
      .notice $2 %ctstart ERROR! You do not have a Bouncer with that AUTH %ctstop
    }
    else {
      .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $readini(bnc.ini,auths,$3) %ctmidt Auth: $3 %ctmidt Host: $iif($readini(bnc.ini,$readini(bnc.ini,auths,$3),ip),$readini(bnc.ini,$readini(bnc.ini,auths,$3),ip),None) %ctmidt Reason: Requestet by User %ctstop
      deluser $readini(bnc.ini,auths,$3) Bouncer deleted!
    }
    unset %antispam
    unset %bnc.*
  }
  if (%bnc.rbnc) {
    if ($readini(bnc.ini,blacklist,$3)) {
      ban -k %requestchan $2 1 %ctstart Black Listed %ctstop
    }
    elseif (bnc !isin $4- && bouncer !isin $4- && $chr(35) !isin $4- && hosted !isin $4-) {
      if ($3 == 0) {
        .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .rbnc %ctmidt if you dont have an AUTH use /msg Q hello your@email your@email %ctstop
      }
      elseif ($readini(bnc.ini,AUTHS,$3)) {
        .notice $2 %ctstart ERROR! You already have a BNC. Your ident is: $readini(bnc.ini,AUTHS,$3) %ctstop
      }
      else {
        set -u36000 %rbnc. [ $+ [ %bnc.ident ] ] 1
        var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
        sbnc adduser %bnc.ident %randpw
        sbnc simul %bnc.ident sbnc set realname 7,1 ~ 15Bouncer by #EvilAC 7~
        sbnc simul %bnc.ident sbnc set server irc.quakenet.org 6667
        writeini bnc.ini %bnc.ident auth $3
        writeini bnc.ini AUTHS $3 %bnc.ident
        .msg %outputchan %ctstart BNC 9,1added %ctmidt Ident: %bnc.ident %ctmidt Nick: $2 %ctmidt Auth: $3 %ctmidt Host: $remove($address($2,2),*!*@) %ctmidt %bnc.numrbnc $+ / $+ %bnc.numrbnc2 %ctstop
        .cprivmsg $2 %requestchan %ctstart Rules: Idle %mainchan - Be AUTH'd and mode +x - Follow Quakenet's Rules - Do NOT get KILLED by S %ctstop
        .cprivmsg $2 %requestchan %ctstart Direct link for connecting to your BNC just paste: $read(bnc\link.txt,1) %ctstop
        .timer 1 2 { .cprivmsg $2 %requestchan %ctstart Ident: %bnc.ident %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
      }
    }
    else {
      .notice $2 %ctstart ERROR! You do not meet the requirements to get a BNC. %ctstop
    }
  }
  unset %bnc.*
  unset %antispam
}

on *:TEXT:.version*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .version x.xxx %ctstop
    }
    else {
      set %version $2
      .msg $nick %ctstart Version is now: $2 %ctstop
    }
  }
}

on *:TEXT:.mainchan*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .MAINCHAN #channel %ctstop
    }
    elseif ($left($2,1) != $chr(35)) {
      .msg $nick %ctstart ERROR! Remember $chr(35) in the channel name. %ctstop
    }
    else {
      set %mainchan $2
      .msg $nick %ctstart Mainchan is now: $2 %ctstop
    }
  }
}

on *:TEXT:.requestchan*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .REQUESTCHAN #channel %ctstop
    }
    elseif ($left($2,1) != $chr(35)) {
      .msg $nick %ctstart ERROR! Remember $chr(35) in the channel name. %ctstop
    }
    else {
      set %requestchan $2
      .msg $nick %ctstart Requestchan is now: $2 %ctstop
    }
  }
}

on *:TEXT:.outputchan*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .OUTPUTCHAN #channel %ctstop
    }
    elseif ($left($2,1) != $chr(35)) {
      .msg $nick %ctstart ERROR! Remember $chr(35) in the channel name. %ctstop
    }
    else {
      set %outputchan $2
      .msg $nick %ctstart Outputchan is now: $2 %ctstop
    }
  }
}

on *:TEXT:.port*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .port 6666 %ctstop
    }
    else {
      set %port $2
      .msg $nick %ctstart Port is now: $2 %ctstop
    }
  }
}

on *:TEXT:.ip*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .ip the.ip.you.have %ctstop
    }
    else {
      set %ip $2
      .msg $nick %ctstart IP is now: $2 %ctstop
    }
  }
}

alias owner {
  if (*!*@int.users* iswm $address($1,5)) {
    return $true
  }
  else {
    return $false
  }
}

alias admin {
  if ($owner($1)) {
    return $true
  }
  if ($1 isop %outputchan) {
    return $true
  }
}

alias isbnc {
  var %txt = $gettok($1,2,64)
  if (.users.quakenet.org isin %txt) {
    return $false
  }
  if (bnc isin %txt) {
    return $true
  }
  if (bouncer isin %txt) {
    return $true
  }
  if (server isin %txt) {
    return $true
  }
  else {
    var %x = 1
    while (%x <= $calc($len(%txt) + 1)) {
      if (%x == $calc($len(%txt) + 1)) {
        if (!%tal) {
          return $true
        }       
        elseif (%tal < 3) {
          return $true
        }
        else {
          return $false
        }
        break
      }     
      if ($mid(%txt,%x,1) isnum) {
        if (!%tal) {
          var %tal = 1
          inc %x
        }
        else {
          inc %tal
          inc %x
        }
      }
      else {
        inc %x
      }
    }
  }
}

on *:TEXT:*:?: {
  if ($nick == -sBNC) {
    if (Trying to reconnect isin $1-) {
      .timer 1 20 sbnc simul $7 join %mainchan
    }
    if (logged on isin $1-) {
      unset %rbnc. [ $+ [ $2 ] ]
      var %ident = $2
      var %host = $gettok($6,1,41)
      if ($readini(bnc.ini,%ident,protect) == yes) {
        halt
      }
      if ($readini(bnc.ini,blacklist,%host)) {
        .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: %ident %ctmidt Auth: $readini(bnc.ini,%ident,auth) %ctmidt Host: %host %ctmidt Reason: Blacklisted %ctstop
        deluser %ident You are Blacklisted and your Bouncer will be deleted!
      }
      elseif ($readini(bnc.ini,ips,%host) && $readini(bnc.ini,ips,%host) != %ident) {
        .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: %ident %ctmidt Auth: $readini(bnc.ini,%ident,auth) %ctmidt Host: %host %ctmidt Reason: Clone %ctstop
        remini bnc.ini AUTHS $readini(bnc.ini,%ident,auth)
        remini bnc.ini %ident
        sbnc tcl setctx %ident $+ $chr(59) bncreply " %ctstart You are a Clone and your Bouncer will be deleted! %ctstop "
        sbnc deluser %ident
      }
      else {
        writeini bnc.ini ips %host %ident
        writeini bnc.ini %ident ip %host
      }
      dns %host
    }
    if (%bnc.status == 1) {
      if ($1- == End of USERS.) {
        inc %bnc.status
        .msg -sbnc vhosts
      }
      if ($chr(42) isin $gettok($1-,1,32)) {
        inc %bnc.online
      }
      if (Last seen isin $1- && $chr(42) !isin $gettok($1,1,40)) {
        if (!$read(bnc\ignore.txt,w,$remove($remove($gettok($gettok($1-,1,32),1,40),@),*))) {
          var %bnc.tid = $translate($gettok($gettok($1-,5-,32),1,93)), %bnc.ident = $remove($remove($gettok($gettok($1-,1,32),1,40),@),*), %bnc.nick = $gettok($gettok($gettok($1-,1,32),2-,40),1,41)
          if ($calc($ctime - $ctime(%bnc.tid)) > 1209600) {
            if ($left($gettok($1-,5,32),5) == Never) {
              if (!%rbnc. [ $+ [ %bnc.ident ] ]) {
                inc %bnc.10H       
                inc %bnc.10Htotal
              }
              else {
                inc %bnc.10Htotal         
              }
            }
            else {
              inc %bnc.2Weeks
            }
          }
        }
      }
    }
    if (%bnc.status == 2) {
      if ($1- == -- End of VHOSTS.) {
        .msg %outputchan %ctstart Usage: %bnc.numstatus $+ / $+ %bnc.numstatus2 %ctmidt Online: %bnc.online %ctmidt 2Weeks: $iif(%bnc.2Weeks,%bnc.2Weeks,0) %ctmidt 10H: $iif(%bnc.10H,%bnc.10H,0) $chr(40) $+ $iif(%bnc.10Htotal,%bnc.10Htotal,0) $+ $chr(41) %ctmidt Sync: $ini(bnc.ini,AUTHS,0) $chr(91) $+ $round($calc($ini(bnc.ini,AUTHS,0) / %bnc.numstatus * 100),0) $+ $chr(37) $+ $chr(93) %ctstop
        unset %bnc.*
        unset %antispam
      }
      else {
        if ($left($3,1) isnum) {
          inc %bnc.numstatus $left($3,1)
          inc %bnc.numstatus2 $right($3,1)
        }
      }
    }
    if (%bnc.rbnc) {
      if ($1- == -- End of VHOSTS.) {
        if (%bnc.numrbnc < %bnc.numrbnc2) {
          who %bnc.nick n%nar
          unset %bnc.nick
        }
        else {
          .notice %bnc.nick %ctstart ERROR! No free slots are left %ctstop
          unset %bnc.*
        }
      }
      else {
        inc %bnc.numrbnc $left($3,1)
        inc %bnc.numrbnc2 $right($3,1)
      }
    }
    if (%bnc.idle) {
      if ($nick == -sBNC) {   
        if ($gettok($gettok($1,2,40),1,41) !ison %mainchan && $remove($remove($gettok($1,1,40),$chr(42),1),$chr(64),1) != quickbnc) {
          inc %bnc.badidentscounter
          if  ($len(%bnc.badidents) < 300) {
            set -u10 %bnc.badidents $addtok(%bnc.badidents,$remove($remove($gettok($1,1,40),$chr(42),1),$chr(64),1),32)
          }
        }
        if (End of USERS. isin $1-) {
          dec %bnc.badidentscounter
          .timer 1 5 .msg %outputchan %ctstart Idents not on %mainchan $+ : $iif($len($left(%bnc.badidents,-4)) > 1,$left(%bnc.badidents,-4),None) $chr(91) $+ $iif(!%bnc.badidentscounter,0,%bnc.badidentscounter) $+ $chr(93) %ctstop
          unset %antispam       
          unset %bnc.*
        }
      }
    }
    if (%bnc.check) {
      if ($1- == End of USERS.) {
        unset %antispam
        unset %bnc.*
        var %x = 1
        var %counter = 1
        while (%x <= $lines(bnc\check.txt)) {
          if ($gettok($gettok($read(bnc\check.txt,%x),5,32),1,93) == Never) {
            if (!%rbnc. [ $+ [ $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) ] ]) {
              .timer 1 $calc(2 * %counter) .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) %ctmidt Auth: $readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),auth) %ctmidt Host: $iif($readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),$readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),none) %ctmidt Reason: Bouncer not logged into the first 10 Hours %ctstop
              .timer 1 $calc(2 * %counter) deluser $remove($gettok($read(bnc\check.txt,%x),1,40),@,*)
              inc %x
            }
            else {
              inc %x
            }
          }
          elseif ($calc($ctime - $ctime($gettok($gettok($read(bnc\check.txt,%x),5-,32),1,93))) > 1209600 && $readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),protect) != yes && $chr(42) !isin $gettok($read(bnc\check.txt,%x),1,40) && $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) != quickbnc) {
            .timer 1 $calc(2 * %counter) .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) %ctmidt Auth: $readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),auth) %ctmidt Host: $iif($readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),$readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),none) %ctmidt Reason: Bouncer idle more than 2 weeks %ctstop
            .timer 1 $calc(2 * %counter) deluser $remove($gettok($read(bnc\check.txt,%x),1,40),@,*)
            inc %counter
            inc %x
          }
          else {
            inc %x
          }
        }
      }
      else {
        write bnc\check.txt $1-
      }
    }
  }
}

alias translate { var %out = $replace($1-,Dez,Dec,Okt,Oct,März,Mar,Mär,Mar,Mai,May,Juni,June,Juli,July,T,$chr(32)) | return %out }

alias -l max.who {
  return 500
}

alias -l delay.who {
  return 60
}

alias -l repeat.who {
  return 30
}

on *:join:%noremovechan: {
  if ($nick == $me) {
    if (!$.timer($+($cid,.ial-update.update))) {
      .timer $+ $cid $+ .ial-update.update 1 $$delay.who ial-update.update
    }
    if ($nick == $me && $chan == %noremovechan) {
      .timerconnect off
    }
  }
}

on *:load:{ scon -am1 .timer $!+ $!cid $!+ .ial-update.update 1 $$delay.who ial-update.update }

alias ial-update.update {
  var %c, %n
  if ($ial) {
    if (!$hget($+(ial-update.,$cid))) { var %c = $ial-update.chan($max.who,400)
      if (%c) { ial-update.hash %c | .quote WHO %c }
      else { var %n = $ial-update.nick($max.who,400)
        if (%n) { ial-update.hash %n | .quote WHO %n  }
      }
    }
    if (%c) || (%n) || ($hget($+(ial-update.,$cid))) {  .timer $+ $cid $+ .ial-update.update 1 $$repeat.who ial-update.update }
  }
}

alias -l ial-update.sort {
  var %x = 1, %c
  while (%x <= $comchan($me,0)) {
    if ($chan($comchan($me,%x)).ial == $false) { var %c = $addtok(%c,$+($nick($comchan($me,%x),0),.,%x),32) }
    inc %x
  }
  return $sorttok(%c,32,n)
}

alias -l ial-update.max {
  var %x = 1, %t = 0, %c = $ial-update.sort, %w
  while (%x <= $numtok(%c,32)) && (%t < $1) {  inc %t $gettok($gettok(%c,%x,32),1,46)
    if (%t > $1) { break }
    var %w = $addtok(%w,$gettok($gettok(%c,%x,32),2,46),32)
    inc %x
  }
  return %w
}

alias -l ial-update.chan {
  var %x = 1, %l = 0, %c = $ial-update.max($1), %w
  while (%x <= $numtok(%c,32)) && (%l < $2) {  inc %l $len(%chan)
    if (%l > $2) { break }
    var %w = $addtok(%w,$comchan($me,$gettok(%c,%x,32)),44)
    inc %x
  }
  return %w
}

alias -l ial-update.nick {
  var %x = 1
  while ($chan($comchan($me,%x)).ial != $false) && (%x <= $comchan($me,0)) {  inc %x }
  if ($chan($comchan($me,%x)).ial == $false) { var %y = 1, %t = 0, %l = 0, %w
    while (%t <= $1) && (%l < $2) && (%y <= $nick($comchan($me,%x),0)) {
      if (!$ial($nick($comchan($me,%x),%y))) {  inc %l $len($nick($comchan($me,%x),%y))
        if (%l > $2) { break }
        var %w = $addtok(%w,$nick($comchan($me,%x),%y),44)
      }
      inc %y
    }
    return %w
  }
}


and my problem is
(20:48:13) (@EvilAC`menu) |EvilAC| BNC deleted |EvilAC| Ident: Kaisar |EvilAC| Auth: aBdUl- |EvilAC| Host: 39.211.178.24 |EvilAC| Reason: Bouncer idle more than 2 weeks |EvilAC|

and this bnc is only 2hours old and it still delete because 14days "idle"

i hope you can help me
Horniibabz
 

Re: BNC script problem

Postby Cristian » Wed Dec 28, 2011 9:29 pm

I'm puzzled to why you use 'on query' to get your information and not from the raw event itself, but never mind.

To help me debug, I need your help.

what does $1- contain?
Code: Select all
write bnc\check.txt $1-


What does this return? (replace %x with a number)
Code: Select all
echo -at $ctime($gettok($gettok($read(bnc\check.txt,%x),5-,32),1,93))


What do you store in 'bnc\check.txt' ?
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: BNC script problem

Postby Horniibabz » Thu Dec 29, 2011 9:39 am

Code: Select all
bidden(sAvior)@ [servercentral.il.us.quakenet.org] [Last seen: 2011-12-28T16:19:54 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
podbot(psychoobitch)@ [underworld2.no.quakenet.org] [Last seen: 2011-12-27T17:22:16 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
slicer(Slicer`OFF)@ [wineasy2.se.quakenet.org] [Last seen: 2011-12-28T18:51:58 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
*proutounz(proutounz)@pa7-84-91-180-166.netvisao.pt [servercentral.il.us.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
danbasten(xpto-DANBasten)@ [servercentral.il.us.quakenet.org] [Last seen: 2011-12-28T21:10:06 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
Gzero(EvilAC`GNZERO)@ [stockholm.se.quakenet.org] [Last seen: 2011-12-28T21:01:38 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
*fruitz(nolimits|FRUITZ)@cb2-84-91-73-55.netvisao.pt [port80b.se.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
*villy(villy^_-)@213.140.86.157 [wineasy2.se.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
*kausen(s2p|kausen)@46-126-165-237.dynamic.hispeed.ch [servercentral.il.us.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
pilsa(pilsa|bnc)@ [stockholm.se.quakenet.org] [Last seen: 2011-12-28T16:10:57 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
@mraxlux(BB`mraxlux)@ [stockholm.se.quakenet.org] [Last seen: 2011-12-28T21:33:07 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
colesnicz(colesn1cz)@ [xs4all.nl.quakenet.org] [Last seen: 2011-12-28T20:01:38 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
*randisen(randi`aw)@188.26.190.56 [underworld1.no.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
*nkl([5up]nkl)@46.10.23.20 [servercentral.il.us.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
@quickbnc(quickbnc)@ [] [Last seen: 2011-12-21T22:53:22 CET] :DO NOT CHANGE OR EDIT!
rntmaN(blood|rnt)@ [wineasy1.se.quakenet.org] [Last seen: 2011-12-28T21:53:17 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
*scoupzeN(blood|scoupzeN)@bl15-155-239.dsl.telepac.pt [wineasy1.se.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
*Anthony(exotic-Anthony)@2.83.161.189 [port80c.se.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
*GoDTuGa(GoDTuGa)@host86-180-216-141.range86-180.btcentralplus.com [port80c.se.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
*spuz(EvilAC`spuZ)@x1-6-5c-d9-98-e5-56-a5.k344.webspeed.dk [stockholm.se.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
iNstinct(iNstinct)@ [underworld1.no.quakenet.org] [Last seen: 2011-12-28T12:54:24 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
@web(EvilAC`web)@ [underworld2.no.quakenet.org] [Last seen: 2011-12-28T21:50:25 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
@*EvilAC([EvilAC])@x1-6-c4-3d-c7-27-df-d2.k405.webspeed.dk [underworld1.no.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
nigzo(nigzoOFF_)@ [xs4all.nl.quakenet.org] [Last seen: 2011-12-28T21:06:23 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
*redgogi(redgogi)@host-2-101-6-18.as13285.net [wineasy1.se.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
machuka(k1p[AFK])@ [servercentral.il.us.quakenet.org] [Last seen: 2011-12-28T01:31:13 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
aKsee(aKse`)@ [servercentral.il.us.quakenet.org] [Last seen: 2011-12-28T14:12:28 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
remnefors(remnefors)@ [underworld2.no.quakenet.org] [Last seen: 2011-12-28T19:15:23 CET] :awaynick R´away
*basch(C^basch)@host86-135-246-164.range86-135.btcentralplus.com [servercentral.il.us.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
halftrax(blood|halftrax)@ [port80c.se.quakenet.org] [Last seen: 2011-12-28T18:51:13 CET] :7,1 ~ 15Bouncer by #EvilAC 7~
*robb(Robb)@c-3dfce255.016-56-6f72652.cust.bredbandsbolaget.se [underworld1.no.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
*SLB(xpto-8anos)@a81-84-238-43.cpe.netcabo.pt [underworld1.no.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~
@*Futz0r(EvilAC`Futz0r)@x1-6-c4-3d-c7-27-df-d2.k405.webspeed.dk [jubii.dk.quakenet.org] [Last seen: Now] :7,1 ~ 15Bouncer by #EvilAC 7~


its all in "sbnc who" so it chekcing for date
Horniibabz
 

Re: BNC script problem

Postby Cristian » Thu Dec 29, 2011 3:08 pm

try and replace

Code: Select all
elseif ($calc($ctime - $ctime($gettok($gettok($read(bnc\check.txt,%x),5-,32),1,93))) > 1209600


with this

Code: Select all
elseif ($ctime - $ctime($replace($gettok($read(bnc\check.txt,%x),5,32),$chr(84),$chr(32))) > 1209600
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: [Solved] BNC script problem

Postby Horniibabz » Mon Jan 02, 2012 3:12 pm

Code: Select all
on *:CONNECT: {
  .timercheck 0 3600 idlecheck
}

alias idlecheck {
  .remove bnc\check.txt
  set -u60 %antispam 1
  unset %bnc.*
  set %bnc.check 1
  /msg -sBNC who
}

on *:text:.bncpart*:%outputchan: {
  if (!%antispam) {
    if ($owner($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .msg %outputchan %ctstart ERROR! use like this: .bncpart #channel (ident) %ctstop
      }
      if (!$3) {
        var %x = 1
        while (%x <= $calc($lines(bnc\idents.txt) + 1)) {
          if (%x == $calc($lines(bnc\idents.txt) + 1)) {
            .msg %outputchan %ctstart All idents have parted $2 %ctstop
            break
          }
          sbnc simul $gettok($read(bnc\idents.txt,%x),1,32) part $2
          inc %x
        }
      }
      elseif ($4) {
        var %x = 1
        while (%x <= $calc($numtok($3-,32) + 1)) {
          if (%x == $calc($numtok($3-,32) + 1)) {
            .msg %outputchan %ctstart The idents have parted $2 %ctstop
            break
          }
          if (!$read(bnc\idents.txt,w,$gettok($3-,%x,32) *)) {
            .msg %outputchan %ctstart $gettok($3-,%x,32) is not added as an ident. %ctstop
            inc %x
          }
          else {
            sbnc simul $gettok($3-,%x,32) part $2
            inc %x
          }
        }
      }
      else {
        sbnc simul $3 part $2
        .msg %outputchan %ctstart $3 has parted $2 %ctstop
      }
    }
  }
}

on *:text:.bncjoin*:%outputchan: {
  if (!%antispam) {
    if ($owner($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .msg %outputchan %ctstart ERROR! use like this: .bncjoin #channel (ident) %ctstop
      }
      elseif (!$3) {
        var %x = 1
        while (%x <= $calc($lines(bnc\idents.txt) + 1)) {
          if (%x == $calc($lines(bnc\idents.txt) + 1)) {
            .msg %outputchan %ctstart All idents have joined $2 %ctstop
            break
          }
          sbnc simul $gettok($read(bnc\idents.txt,%x),1,32) join $2
          inc %x
        }
      }
      elseif ($4) {
        var %x = 1
        while (%x <= $calc($numtok($3-,32) + 1)) {
          if (%x == $calc($numtok($3-,32) + 1)) {
            break
          }
          else {
            .timer 1 %x { sbnc simul $gettok($3-,%x,32) join $2 }
            .timer 1 $calc(%x + 3) { joincheck $gettok($3-,%x,32) $2 }
            set -u20 %bnc.join. [ $+ [ $gettok($3-,%x,32) ] ] 1
            inc %x
          }
        }
      }
      else {
        sbnc simul $3 join $2
        .timer 1 3 { joincheck $3 $2 }
        set -u5 %bnc.join. [ $+ [ $3 ] ] 1
      }
    }
  }
}

alias joincheck {
  if (%bnc.join. [ $+ [ $1 ] ]) {
    .msg %outputchan %ctstart $1 did not join $2 %ctstop
  }
  else {
    .msg %outputchan %ctstart $1 joined $2 %ctstop
  }
}

on *:text:.bncblacklist*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      if (!$2 || !$3) {
        .notice $nick %ctstart ERROR! Use like this: .bncblacklist add/del auth/host %ctstop
      }
      elseif ($2 == add) {
        if ($readini(bnc.ini,blacklist,$3)) {
          .notice $nick %ctstart ERROR! $3 is already Blacklisted %ctstop
        }
        else {
          writeini bnc.ini blacklist $3 1
          .msg $chan %ctstart $3 was added to the Blacklist %ctstop
        }
      }
      elseif ($2 == del) {
        if (!$readini(bnc.ini,blacklist,$3)) {
          .notice $nick %ctstart ERROR! $3 is not Blacklisted %ctstop
        }
        else {
          remini bnc.ini blacklist $3
          .msg $chan %ctstart $3 was deleted from the Blacklist %ctstop
        }
      }
    }
  }
}

on *:text:.bncprotect*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .bncprotect ident %ctstop
      }
      elseif (!$readini(bnc.ini,$2,auth)) {
        .notice $nick %ctstart ERROR! $2 is not added %ctstop
      }
      else {
        if ($readini(bnc.ini,$2,protect) == yes) {
          writeini bnc.ini $2 protect no
          .msg $chan %ctstart $2 is NOT protected anymore %ctstop
        }
        else {
          writeini bnc.ini $2 protect yes
          .msg $chan %ctstart $2 is now protected %ctstop
        }
      }
    }
  }
}

on *:text:.bncrequest*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .notice $nick %ctstart ERROR! use like this: .bncrequest on/off (reason) %ctstop
      }
      elseif (%requeststatus == $2) {
        .msg $chan %ctstart Request is already $2 %ctstop
      }
      else {
        set %requeststatus $2
        .msg $chan %ctstart Request is now $2 %ctstop
        if ($2 == on) {
          topic %requestchan %ctstart For help with a Bouncer use: .bnchelp %ctmidt Bot version %version %ctmidt Request: 9ON %ctstop
          unset %requestdetail
        }
        elseif ($2 == off) {
          if (!$3-) {
            topic %requestchan %ctstart For help with a Bouncer use: .bnchelp %ctmidt Bot version %version %ctmidt Request: 4OFF %ctstop
            set %requestdetail See topic!
          }
          else {
            topic %requestchan %ctstart $3- %ctmidt Bot version %version %ctmidt Request: 4OFF %ctstop
            set %requestdetail $3-
          }
        }
      }
    }
  }
}

on *:TEXT:.bnckill*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .bnckill IDENT %ctstop
      }
      elseif (!$readini(bnc.ini,$2,auth)) {
        .notice $nick ERROR! $2 is not added as an ident %ctstop
      }
      else {
        sbnc kill $2
        .notice $nick %ctstart $2 was killed %ctstop
      }
    }
  }
}

on *:text:.bncstatus:%outputchan: {
  if ($admin($nick)) {
    if (!%antispam) {
      set -u60 %antispam 1
      unset %bnc.*
      set %bnc.status 1
      /msg -sBNC who
    }
  }
}

on *:TEXT:.bncmsg*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2 || !$3) {
        .notice $nick %ctstart ERROR! Use like this: .bncmsg IDENT MSG %ctstop
      }
      elseif (!$readini(bnc.ini,$2,auth)) {
        .notice $nick ERROR! $2 is not added as an ident %ctstop
      }
      else {
        set %bnc.msg 1
        sbnc tcl setctx $2 $+ $chr(59) bncreply " %ctstart $3- (Admin: $nick $+ ) %ctstop "
      }
    }
  }
}

on *:TEXT:.bncglobal*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .bncglobal MSG %ctstop
      }
      else {
        sbnc global %ctstart $2- %ctstop
      }
    }
  }
}

on *:part:%MAINCHAN: {
  if ($readini(bnc.ini,$remove($gettok($address($nick,1),1,64),*!*),auth)) {
    sbnc simul $remove($gettok($address($nick,1),1,64),*!*) join $chan
    sbnc tcl setctx $remove($gettok($address($nick,1),1,64),*!*) ; bncreply " %ctstart You are violating Bouncer rules! Stay at %mainchan %ctstop "
  }
}

on *:kick:%mainchan: {
  if ($readini(bnc.ini,$remove($gettok($address($nick,1),1,64),*!*),auth)) {
    sbnc simul $remove($gettok($address($knick,1),1,64),*!*) join $chan
  }
}

on *:TEXT:.bncpass:%REQUESTCHAN: {
  if (!%antispam) {
    if ($3 && $admin($nick)) {
      if (!$readini(bnc.ini,$2,auth)) {
        .notice $nick %ctstart ERROR! That ident is not added %ctstop
      }
      else {
        var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
        sbnc resetpass $2 %randpw
        .msg %outputchan %ctstart BNC 8,1reset %ctmidt Ident: $2 %ctmidt Nick: $3 %ctmidt Auth: $readini(bnc.ini,$3,auth) %ctmidt Host: $remove($address($2,2),*!*@) %ctstop
        .cprivmsg $2 %requestchan Direct link use: $read(bnc\link.txt,3)
        .timer 1 2 { .cprivmsg $3 %requestchan %ctstart Ident: $2 %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
      }
    }
    else {
      set %bnc.reset $nick
      set -u7 %antispam 1
      who $nick n%nar
    }
  }
}

on *:text:.bncidle:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set %antispam 1
      set %bnc.idle 1
      /msg -sBNC who
    }
  }
}

on *:TEXT:.bncwhoami:%REQUESTCHAN: {
  if (!%antispam) {
    set %bnc.whoami $nick
    set -u7 %antispam 1
    who $nick n%nar
  }
}

on *:TEXT:.help*:%outputchan: {
  if (!%antispam) {
    if ($nick !isreg $chan) {
      set -u5 %antispam 1
      if (!$2) {
        .cnotice $nick $chan %ctstart Commands: .bncadd|.bncdel|.bncpass|.bncidle|.bncstatus|.bncglobal|.bncrequest %ctstop
        .cnotice $nick $chan %ctstart --------- .bncblacklist|.bncprotect|.bnckill|.bncmsg|.bncjoin|.bncpart %ctstop
        .cnotice $nick $chan %ctstart For more help use: .help <command> EXAMPLE: .help bncdeny
      }
      else {
        var %x = 1
        while (%x <= $calc($lines(bnc\adminhelp.txt) + 1)) {
          if (%x == $calc($lines(bnc\adminhelp.txt) + 1)) {
            .cnotice $nick $chan %ctstart ERROR! That command does not exist %ctstop
          }
          if ($gettok($read(bnc\adminhelp.txt,%x),1,128) == $2) {
            .cnotice $nick $chan %ctstart $gettok($read(bnc\adminhelp.txt,%x),4,128) %ctstop
            .cnotice $nick $chan %ctstart $gettok($read(bnc\adminhelp.txt,%x),2,128) EXAMPLE: $gettok($read(bnc\adminhelp.txt,%x),3,128) %ctstop
            break   
          }
          inc %x
        }
      }
    }
  }
}

alias -l bnclist {
  var %i = 1
  while (%i <= $lines(bnc\help.txt)) {
    var %bnclist = $addtok(%bnclist,$chr(91) $+ %i $+ $chr(93) $left($gettok($read(bnc\help.txt,%i),1,126),1) $+ $right($gettok($read(bnc\help.txt,%i),1,126),-1) %ctmidt ,32)
    inc %i
  }
  return %bnclist
}

on *:text:.bnchelp*:%requestchan: {
  if (!$2) {
    .cnotice $nick $chan %ctstart Hi $nick $+ , you have got the following options: %ctstop
    .cnotice $nick $chan %ctstart $left($bnclist,-9) %ctstop
    .cnotice $nick $chan %ctstart Write .bnchelp 1/2/3 etc, to get help on that problem. %ctstop
  }
  if ($2 == list) && ($nick isop %requestchan) {
    var %i = 1
    while (%i <= $lines(bnc\help.txt)) {
      .timer 1 %i { .cnotice $nick $chan %ctstart $+ %i $+ / $+  $+ $gettok($read(bnc\help.txt,%i),1,126) $+  %ctstop $gettok($read(bnc\help.txt,%i),2-,126) $+  }
      inc %i
    }
  }
  if ($2 == commands) && ($nick isop %requestchan) {
    .cnotice $nick $chan %ctstart BNC help commands: %ctstop
    .cnotice $nick $chan %ctstart .bnchelp add|del|edit|list|N %ctstop
  }
  if ($2 == edit) && ($nick isop %requestchan) {
    if (!$3) {
      .cnotice $nick ERROR! use like this: .bnchelp edit <N> <NEW TEXT HERE> %ctstop
    }
    if ($3 isnum) {
      if (!$read(bnc\help.txt,$3)) {
        .cnotice $nick $chan %ctstart Could not find $3 in my database. %ctstop
      }
      else {
        .cnotice $nick $chan %ctstart $gettok($read(bnc\help.txt,$3),1,32) was reset and updated to: $chr(91) $+ $3 $+ / $+ $gettok($read(bnc\help,n,$3),1,126) $+ $chr(93) $4- %ctstop
        write -l $+ $readn bnc\help.txt $gettok($read(bnc\help.txt,n,$3),1,126) $+ $chr(126) $+ $4-
      }
    }
  }
  if ($2 == add) && ($nick isop %requestchan) {
    if (!$3) {
      .cnotice $nick $chan ERROR! use like this: .bnchelp add <Headline~New text here> %ctstop
    }
    elseif ($read(bnc\help.txt,w,$gettok($3-,1,126) $+ $chr(126))) {
      .cnotice $nick $chan %ctstart $3 already exists. %ctstop
    }
    else {
      write bnc\help.txt $3-     
      .cnotice $nick $chan %ctstart Successfully added $3 %ctstop
    }
  }
  if ($2 == del) && ($nick isop %requestchan) {
    if (!$3) {
      .cnotice $nick ERROR! use like this: .bnchelp del Nr %ctstop
    }
    if ($3 isnum) {
      if ($3 > $lines(bnc\help.txt)) {
        .cnotice $nick $chan %ctstart There is not that many entries added %ctstop
      }
      else {
        .cnotice $nick $chan %ctstart $gettok($read(bnc\help.txt,$3),1,32) was deleted %ctstop
        $read(bnc\help.txt,$3)
        write -dl $+ $readn bnc\help.txt
      }
    }
  }
  else {
    if ($2 isnum && $read(bnc\help.txt,$2)) {
      .cnotice $nick $chan %ctstart  $+ $2 $+  $+ / $+  $+ $gettok($read(bnc\help.txt,$2),1,126) $+  %ctstop $gettok($read(bnc\help.txt,$2),2-,126)
    }
    else {
      var %x = 1
      var %y = 0
      while (%x <= $lines(bnc\help.txt)) {
        if ($2- isin $gettok($read(bnc\help.txt,n,%x),1,126)) {
          inc %y
          .timer 1 %y .cnotice $nick $chan %ctstart  $+ %x $+  $+ / $+  $+ $gettok($read(bnc\help.txt,n,%x),1,126) $+  %ctstop $gettok($read(bnc\help.txt,n,%x),2-,126)
        }
        inc %x
      }
    }
  }
}

on *:text:.bncadd*:%outputchan: {
  if (!%antispam) {
    if ($admin($nick)) {
      set -u3 %antispam 1
      if (!$2 || !$3 || !$4) {
        .notice $nick ERROR! Use like this: .bncadd ident nick auth
      }
      elseif ($read(bnc\idents.txt,w,$2 *)) {
        .notice $nick %ctstart ERROR! That ident already exists. %ctstop
      }
      else {
        set -u36000 %rbnc. [ $+ [ $2 ] ] 1
        var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
        sbnc adduser $2 %randpw
        sbnc simul $2 sbnc set realname 7,1 ~ 15Bouncer by #EvilAC 7~
        sbnc simul $2 sbnc set server irc.quakenet.org 6667
        writeini bnc.ini AUTHS $4 $2
        writeini bnc.ini $2 auth $4
        .msg $chan %ctstart BNC 9,1added %ctmidt Ident: $2 %ctmidt Nick: $3 %ctmidt AUTH: $4 %ctmidt Host: $remove($address($3,2),*!*@) %ctstop
        .cprivmsg $3 %requestchan %ctstart Rules: Idle %mainchan - Be AUTH'd and mode +x - Follow Quakenet's Rules - Do NOT get KILLED by S %ctstop
        .cprivmsg $3 %requestchan %ctstart Direct link for connecting to your BNC just paste: $read(bnc\link.txt,3) %ctstop
        .timer 1 2 { .cprivmsg $3 %requestchan %ctstart Ident: $2 %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
      }
    }
  }
}

on *:text:.bncdel*:%REQUESTCHAN,%outputchan: {
  if (!%antispam) {
    if (%requeststatus == on) {
      if ($2 && $admin($nick) && $chan == %outputchan) {
        if ($readini(bnc.ini,$2,auth)) {
          .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $2 %ctmidt Auth: $readini(bnc.ini,$2,auth) %ctmidt Host: $iif($readini(bnc.ini,$2,ip),$readini(bnc.ini,$2,ip),None) %ctmidt Reason: Requestet by Admin %ctstop
          deluser $2 Your Bouncer was deleted by admin: $nick
        }
        else {
          .notice $nick %ctstart ERROR! That ident is not added %ctstop
        }
      }
      else {
        unset %bnc.*
        set %bnc.del 1
        set %bnc.nick $nick
        set -u20 %antispam 1
        who $nick n%nar
      }
    }
    else {
      .notice $nick %ctstart .bncdel is currently disabled (Reason: %requestdetail $+ ) %ctstop
    }
  }
}

on *:text:.Rbnc*:%REQUESTCHAN: {
  if (!%antispam) {
    if (%requeststatus == on) {
      if (!$2) {
        .notice $nick %ctstart ERROR! Use like this: .Rbnc IDENT %ctstop
      }
      elseif ($isbnc($address($nick,2))) {
        .notice $2 %ctstart ERROR! You do not meet the requirements to get a BNC. %ctstop
      }
      elseif ($2 !isalpha) {
        .notice $nick %ctstart ONLY letters a-Z can be in your ident. %ctstop
      }
      elseif ($len($2) > 9) {
        .notice $nick %ctstart Your ident is too long, max 9 characters. %ctstop
      }
      elseif ($readini(bnc.ini,$2,auth)) {
        .notice $nick %ctstart ERROR! That ident is already in use. %ctstop
      }
      else {
        unset %bnc.*
        set %bnc.rbnc 1
        set %bnc.nick $nick
        set -u20 %antispam 1
        set -u20 %bnc.ident $2
        .msg -sBNC vhosts
      }
    }
    else {
      .notice $nick %ctstart .rBNC is currently disabled (Reason: %requestdetail $+ ) %ctstop
    }
  }
}

alias deluser {
  sbnc tcl setctx $1 ; bncreply " %ctstart $2- %ctstop "
  sbnc deluser $1
  if ($readini(bnc.ini,$1,auth)) { remini bnc.ini AUTHS $readini(bnc.ini,$1,auth) }
  if ($readini(bnc.ini,$1,ip)) { remini bnc.ini IPS $readini(bnc.ini,$1,ip) }
  if ($1) { remini bnc.ini $1 }
}

raw 354:*: {
  /haltdef
  if (%bnc.whoami) {
    if ($3 == 0) {
      .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .bncwhoami %ctstop
    }
    elseif ($readini(bnc.ini,auths,$3)) {
      .notice $2 %ctstart Your have a Bouncer %ctmidt Ident: $readini(bnc.ini,auths,$3) %ctmidt Auth: $3 %ctstop
    }
    else {
      .notice $2 %ctstart ERROR! You do not have a bouncer %ctstop
    }
  }
  if (%bnc.reset) {
    if ($3 == 0) {
      .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .bncpass %ctstop
    }
    elseif ($readini(bnc.ini,auths,$3)) {
      var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
      sbnc resetpass $readini(bnc.ini,auths,$3) %randpw
      .msg %outputchan %ctstart BNC 8,1reset %ctmidt Ident: $readini(bnc.ini,auths,$3) %ctmidt Nick: $2 %ctmidt Auth: $3 %ctmidt Host: $remove($address($2,2),*!*@) %ctstop
      .cprivmsg $2 %requestchan Direct link use: $read(bnc\link.txt,2)
      .timer 1 2 { .cprivmsg $2 %requestchan %ctstart Ident: $readini(bnc.ini,auths,$3) %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
    }
    else {
      .notice $2 %ctstart ERROR! You do not have a bouncer %ctstop
    }
  }
  if (%bnc.del) {
    if ($readini(bnc.ini,blacklist,$3)) {
      ban -k %requestchan $2 1 %ctstart Black Listed %ctstop
    }
    elseif ($3 == 0) {
      .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .bncdel %ctstop
    }
    elseif (!$readini(bnc.ini,auths,$3)) {
      .notice $2 %ctstart ERROR! You do not have a Bouncer with that AUTH %ctstop
    }
    else {
      .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $readini(bnc.ini,auths,$3) %ctmidt Auth: $3 %ctmidt Host: $iif($readini(bnc.ini,$readini(bnc.ini,auths,$3),ip),$readini(bnc.ini,$readini(bnc.ini,auths,$3),ip),None) %ctmidt Reason: Requestet by User %ctstop
      deluser $readini(bnc.ini,auths,$3) Bouncer deleted!
    }
    unset %antispam
    unset %bnc.*
  }
  if (%bnc.rbnc) {
    if ($readini(bnc.ini,blacklist,$3)) {
      ban -k %requestchan $2 1 %ctstart Black Listed %ctstop
    }
    elseif (bnc !isin $4- && bouncer !isin $4- && $chr(35) !isin $4- && hosted !isin $4-) {
      if ($3 == 0) {
        .notice $2 %ctstart ERROR! You MUST be AUTH'd to use .rbnc %ctmidt if you dont have an AUTH use /msg Q hello your@email your@email %ctstop
      }
      elseif ($readini(bnc.ini,AUTHS,$3)) {
        .notice $2 %ctstart ERROR! You already have a BNC. Your ident is: $readini(bnc.ini,AUTHS,$3) %ctstop
      }
      else {
        set -u36000 %rbnc. [ $+ [ %bnc.ident ] ] 1
        var %randpw = $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(a,z)
        sbnc adduser %bnc.ident %randpw
        sbnc simul %bnc.ident sbnc set realname 7,1 ~ 15Bouncer by #EvilAC 7~
        sbnc simul %bnc.ident sbnc set server irc.quakenet.org 6667
        writeini bnc.ini %bnc.ident auth $3
        writeini bnc.ini AUTHS $3 %bnc.ident
        .msg %outputchan %ctstart BNC 9,1added %ctmidt Ident: %bnc.ident %ctmidt Nick: $2 %ctmidt Auth: $3 %ctmidt Host: $remove($address($2,2),*!*@) %ctmidt %bnc.numrbnc $+ / $+ %bnc.numrbnc2 %ctstop
        .cprivmsg $2 %requestchan %ctstart Rules: Idle %mainchan - Be AUTH'd and mode +x - Follow Quakenet's Rules - Do NOT get KILLED by S %ctstop
        .cprivmsg $2 %requestchan %ctstart Direct link for connecting to your BNC just paste: $read(bnc\link.txt,1) %ctstop
        .timer 1 2 { .cprivmsg $2 %requestchan %ctstart Ident: %bnc.ident %ctmidt Ip: %ip %ctmidt Port: %port %ctmidt Password: %randpw %ctstop }
      }
    }
    else {
      .notice $2 %ctstart ERROR! You do not meet the requirements to get a BNC. %ctstop
    }
  }
  unset %bnc.*
  unset %antispam
}

on *:TEXT:.version*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .version x.xxx %ctstop
    }
    else {
      set %version $2
      .msg $nick %ctstart Version is now: $2 %ctstop
    }
  }
}

on *:TEXT:.mainchan*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .MAINCHAN #channel %ctstop
    }
    elseif ($left($2,1) != $chr(35)) {
      .msg $nick %ctstart ERROR! Remember $chr(35) in the channel name. %ctstop
    }
    else {
      set %mainchan $2
      .msg $nick %ctstart Mainchan is now: $2 %ctstop
    }
  }
}

on *:TEXT:.requestchan*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .REQUESTCHAN #channel %ctstop
    }
    elseif ($left($2,1) != $chr(35)) {
      .msg $nick %ctstart ERROR! Remember $chr(35) in the channel name. %ctstop
    }
    else {
      set %requestchan $2
      .msg $nick %ctstart Requestchan is now: $2 %ctstop
    }
  }
}

on *:TEXT:.outputchan*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .OUTPUTCHAN #channel %ctstop
    }
    elseif ($left($2,1) != $chr(35)) {
      .msg $nick %ctstart ERROR! Remember $chr(35) in the channel name. %ctstop
    }
    else {
      set %outputchan $2
      .msg $nick %ctstart Outputchan is now: $2 %ctstop
    }
  }
}

on *:TEXT:.port*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .port 6666 %ctstop
    }
    else {
      set %port $2
      .msg $nick %ctstart Port is now: $2 %ctstop
    }
  }
}

on *:TEXT:.ip*:?: {
  if ($owner($nick)) {
    if (!$2) {
      .msg $nick %ctstart ERROR! use like this: .ip the.ip.you.have %ctstop
    }
    else {
      set %ip $2
      .msg $nick %ctstart IP is now: $2 %ctstop
    }
  }
}

alias owner {
  if (*!*@Futz0r.users* iswm $address($1,5)) {
    return $true
  }
  else {
    return $false
  }
}

alias admin {
  if ($owner($1)) {
    return $true
  }
  if ($1 isop %outputchan) {
    return $true
  }
}

alias isbnc {
  var %txt = $gettok($1,2,64)
  if (*!*@*.users.quakenet.org iswm $1) || (!$1) { echo -s COKE: 1 | return $false }
  if (bnc isin %txt) || (bouncer isin %txt) || (server isin %txt) { echo -s COKE: 2 | return $true }
  var %x = 1, %tal = 0
  while (%x <= $calc($len(%txt) + 1)) {
    if ($mid(%txt,%x,1) isnum) { inc %tal }
    inc %x
  }
  if (!%tal) || (%tal < 3) { echo -s COKE: 3 | return $true }     
  echo -s COKE: 4 | return $false
}


on *:TEXT:*:?: {
  if ($nick == -sBNC) {
    if (Trying to reconnect isin $1-) {
      .timer 1 20 sbnc simul $7 join %mainchan
    }
    if (logged on isin $1-) {
      unset %rbnc. [ $+ [ $2 ] ]
      var %ident = $2
      var %host = $gettok($6,1,41)
      if ($readini(bnc.ini,%ident,protect) == yes) {
        halt
      }
      if ($readini(bnc.ini,blacklist,%host)) {
        .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: %ident %ctmidt Auth: $readini(bnc.ini,%ident,auth) %ctmidt Host: %host %ctmidt Reason: Blacklisted %ctstop
        deluser %ident You are Blacklisted and your Bouncer will be deleted!
      }
      elseif ($readini(bnc.ini,ips,%host) && $readini(bnc.ini,ips,%host) != %ident) {
        .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: %ident %ctmidt Auth: $readini(bnc.ini,%ident,auth) %ctmidt Host: %host %ctmidt Reason: Clone %ctstop
        remini bnc.ini AUTHS $readini(bnc.ini,%ident,auth)
        remini bnc.ini %ident
        sbnc tcl setctx %ident $+ $chr(59) bncreply " %ctstart You are a Clone and your Bouncer will be deleted! %ctstop "
        sbnc deluser %ident
      }
      else {
        writeini bnc.ini ips %host %ident
        writeini bnc.ini %ident ip %host
      }
      dns %host
    }
    if (%bnc.status == 1) {
      if ($1- == End of USERS.) {
        inc %bnc.status
        .msg -sbnc vhosts
      }
      if ($chr(42) isin $gettok($1-,1,32)) {
        inc %bnc.online
      }
      if (Last seen isin $1- && $chr(42) !isin $gettok($1,1,40)) {
        if (!$read(bnc\ignore.txt,w,$remove($remove($gettok($gettok($1-,1,32),1,40),@),*))) {
          var %bnc.tid = $translate($gettok($gettok($1-,5,32),1,93)), %bnc.ident = $remove($remove($gettok($gettok($1-,1,32),1,40),@),*), %bnc.nick = $gettok($gettok($gettok($1-,1,32),2-,40),1,41)
          if ($calc($ctime - $ctime(%bnc.tid)) > 1209600) {
            if ($left($gettok($1-,5,32),5) == Never) {
              if (!%rbnc. [ $+ [ %bnc.ident ] ]) {
                inc %bnc.10H     
                inc %bnc.10Htotal
              }
              else {
                inc %bnc.10Htotal       
              }
            }
            else {
              inc %bnc.2Weeks
            }
          }
        }
      }
    }
    if (%bnc.status == 2) {
      if ($1- == -- End of VHOSTS.) {
        .msg %outputchan %ctstart Usage: %bnc.numstatus $+ / $+ %bnc.numstatus2 %ctmidt Online: %bnc.online %ctmidt 2Weeks: $iif(%bnc.2Weeks,%bnc.2Weeks,0) %ctmidt 10H: $iif(%bnc.10H,%bnc.10H,0) $chr(40) $+ $iif(%bnc.10Htotal,%bnc.10Htotal,0) $+ $chr(41) %ctmidt Sync: $ini(bnc.ini,AUTHS,0) $chr(91) $+ $round($calc($ini(bnc.ini,AUTHS,0) / %bnc.numstatus * 100),0) $+ $chr(37) $+ $chr(93) %ctstop
        unset %bnc.*
        unset %antispam
      }
      else {
        if ($left($3,1) isnum) {
          inc %bnc.numstatus $left($3,1)
          inc %bnc.numstatus2 $right($3,1)
        }
      }
    }
    if (%bnc.rbnc) {
      if ($1- == -- End of VHOSTS.) {
        if (%bnc.numrbnc < %bnc.numrbnc2) {
          who %bnc.nick n%nar
          unset %bnc.nick
        }
        else {
          .notice %bnc.nick %ctstart ERROR! No free slots are left %ctstop
          unset %bnc.*
        }
      }
      else {
        inc %bnc.numrbnc $left($3,1)
        inc %bnc.numrbnc2 $right($3,1)
      }
    }
    if (%bnc.idle) {
      if ($nick == -sBNC) { 
        if ($gettok($gettok($1,2,40),1,41) !ison %mainchan && $remove($remove($gettok($1,1,40),$chr(42),1),$chr(64),1) != quickbnc) {
          inc %bnc.badidentscounter
          if  ($len(%bnc.badidents) < 300) {
            set -u10 %bnc.badidents $addtok(%bnc.badidents,$remove($remove($gettok($1,1,40),$chr(42),1),$chr(64),1),32)
          }
        }
        if (End of USERS. isin $1-) {
          dec %bnc.badidentscounter
          .timer 1 5 .msg %outputchan %ctstart Idents not on %mainchan $+ : $iif($len($left(%bnc.badidents,-4)) > 1,$left(%bnc.badidents,-4),None) $chr(91) $+ $iif(!%bnc.badidentscounter,0,%bnc.badidentscounter) $+ $chr(93) %ctstop
          unset %antispam     
          unset %bnc.*
        }
      }
    }
    if (%bnc.check) {
      if ($1- == End of USERS.) {
        unset %antispam
        unset %bnc.*
        var %x = 1, %counter = 1
        while (%x <= $lines(bnc\check.txt)) {
          var %seen = $translate($gettok($gettok($read(bnc\check.txt,%x),5,32),1,93)), %time = $ctime(%seen), %lastseen = $calc($ctime - %time)
          if (%seen == Never) {
            if (!%rbnc. [ $+ [ $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) ] ]) {
              .timer 1 $calc(2 * %counter) .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) %ctmidt Auth: $readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),auth) %ctmidt Host: $iif($readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),$readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),none) %ctmidt Reason: Bouncer not logged into the first 10 Hours %ctstop
              .timer 1 $calc(2 * %counter) deluser $remove($gettok($read(bnc\check.txt,%x),1,40),@,*)
              inc %counter
            }
          }
          elseif (%seen != Now) && (%lastseen >= 1209600) { echo -s Vis cokE: %x ::: Original: %seen ::: Ctime: %time ::: Secs: %lastseen
            if (%lastseen isnum) {
              if ($readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),protect) != yes && $chr(42) !isin $gettok($read(bnc\check.txt,%x),1,40) && $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) != quickbnc) {
                .timer 1 $calc(2 * %counter) .msg %outputchan %ctstart BNC 4deleted %ctmidt Ident: $remove($gettok($read(bnc\check.txt,%x),1,40),@,*) %ctmidt Auth: $readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),auth) %ctmidt Host: $iif($readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),$readini(bnc.ini,$remove($gettok($read(bnc\check.txt,%x),1,40),@,*),ip),none) %ctmidt Reason: Bouncer idle more than 2 weeks %ctstop
                .timer 1 $calc(2 * %counter) deluser $remove($gettok($read(bnc\check.txt,%x),1,40),@,*)
                inc %counter
              }
            }
            else { .timer 1 $calc(2 * %counter) .msg %outputchan %ctstart Sletter ikke (Linje: %x $+ ) - %ctmidt Original: %seen ][ Ctime: %time ][ Secs: %lastseen %ctstop | inc %counter }
          }
          inc %x
        }
      }
      else {
        write bnc\check.txt $1-
      }
    }
  }
}
alias translate { var %out = $replace($1-,Dez,Dec,Okt,Oct,März,Mar,Mär,Mar,Mai,May,Juni,June,Juli,July,T,$chr(32)) | return %out }

alias -l max.who {
  return 500
}

alias -l delay.who {
  return 60
}

alias -l repeat.who {
  return 30
}

on *:join:%noremovechan: {
  if ($nick == $me) {
    if (!$.timer($+($cid,.ial-update.update))) {
      .timer $+ $cid $+ .ial-update.update 1 $$delay.who ial-update.update
    }
    if ($nick == $me && $chan == %noremovechan) {
      .timerconnect off
    }
  }
}

on *:load:{ scon -am1 .timer $!+ $!cid $!+ .ial-update.update 1 $$delay.who ial-update.update }

alias ial-update.update {
  var %c, %n
  if ($ial) {
    if (!$hget($+(ial-update.,$cid))) { var %c = $ial-update.chan($max.who,400)
      if (%c) { ial-update.hash %c | .quote WHO %c }
      else { var %n = $ial-update.nick($max.who,400)
        if (%n) { ial-update.hash %n | .quote WHO %n  }
      }
    }
    if (%c) || (%n) || ($hget($+(ial-update.,$cid))) {  .timer $+ $cid $+ .ial-update.update 1 $$repeat.who ial-update.update }
  }
}

alias -l ial-update.sort {
  var %x = 1, %c
  while (%x <= $comchan($me,0)) {
    if ($chan($comchan($me,%x)).ial == $false) { var %c = $addtok(%c,$+($nick($comchan($me,%x),0),.,%x),32) }
    inc %x
  }
  return $sorttok(%c,32,n)
}

alias -l ial-update.max {
  var %x = 1, %t = 0, %c = $ial-update.sort, %w
  while (%x <= $numtok(%c,32)) && (%t < $1) {  inc %t $gettok($gettok(%c,%x,32),1,46)
    if (%t > $1) { break }
    var %w = $addtok(%w,$gettok($gettok(%c,%x,32),2,46),32)
    inc %x
  }
  return %w
}

alias -l ial-update.chan {
  var %x = 1, %l = 0, %c = $ial-update.max($1), %w
  while (%x <= $numtok(%c,32)) && (%l < $2) {  inc %l $len(%chan)
    if (%l > $2) { break }
    var %w = $addtok(%w,$comchan($me,$gettok(%c,%x,32)),44)
    inc %x
  }
  return %w
}

alias -l ial-update.nick {
  var %x = 1
  while ($chan($comchan($me,%x)).ial != $false) && (%x <= $comchan($me,0)) {  inc %x }
  if ($chan($comchan($me,%x)).ial == $false) { var %y = 1, %t = 0, %l = 0, %w
    while (%t <= $1) && (%l < $2) && (%y <= $nick($comchan($me,%x),0)) {
      if (!$ial($nick($comchan($me,%x),%y))) {  inc %l $len($nick($comchan($me,%x),%y))
        if (%l > $2) { break }
        var %w = $addtok(%w,$nick($comchan($me,%x),%y),44)
      }
      inc %y
    }
    return %w
  }
}
Horniibabz
 


Return to Mirc Scripting Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron