All pastes #815522 Raw Edit

Auth_stsrem V1.6

public text v1 · immutable
·published 2007-12-14 03:33 UTC
rendered paste body
;##########################################################
;#### Snpster Auth/user system(gamesurge) #Snp V1.6 #######
;##########################################################
on *:TEXT:.*:*: {
  set %my.chan $chan
  set %auth.nick $nick
  set %auth.command $1-
  whois $nick
}
;#########################################################
;############### Muli`chan Commands ######################
;#########################################################
;#########################################################
raw 330:*:{
  set %auth.user $3
  if (%auth_ban == 1 ) {
    set %auth.level $null
    set %auth.level $readini(data.ini,users,%auth.user)
    if (!%auth.level) || (%auth.level !isnum) || (%auth.level < 0) {
      set %auth.level 0
    }
    if (%auth.level >= %b.auth_level) {
      msg %my.chan %skin.start Ban %skin.mid $3 $+ ( $+ %auth.nick $+ ) has equal or greater access, you cannot ban them %skin.end
      set %auth_ban 0
    }
    elseif (%auth.level < %b.auth_level) {
      msg chanserv %my.chan ban %auth.nick %auth.b_msg
      msg %my.chan %skin.start Ban %skin.mid $3 $+ ( $+ %auth.nick $+ ) has been Banned Reason:5 %auth.k_msg %skin.end
      set %auth_ban 0
    }
  }




  if (%auth_kick == 1) {
    set %auth.level $null
    set %auth.level $readini(data.ini,users,%auth.user)
    if (!%auth.level) {
      set %auth.level 0
    }
    if (%auth.level >= %k.auth_level) {
      msg %my.chan %skin.start Kick %skin.mid $3 $+ ( $+ %auth.nick $+ ) has equal or greater access, you cannot kick them %skin.end
      set %auth_kick 0
    }
    elseif (%auth.level < %k.auth_level) {
      msg chanserv %my.chan kick %auth.nick %auth.k_msg
      msg %my.chan %skin.start Kick %skin.mid $3 $+ ( $+ %auth.nick $+ ) has been kicked Reason:5 %auth.k_msg %skin.end
      set %auth_kick 0
    }
  }





  elseif (%auth_add.user == 1) {
    writeini data.ini users %auth.user %auth_add.level
    msg %my.chan %skin.start User(s) %skin.mid $3 $+ ( $+ %auth.nick $+ ) has been added with access %auth_add.level %skin.end
    set %auth_add.user 0
  } 




  elseif (%auth_del.user == 1) {
    set %auth.level $readini(data.ini,users,%auth.user)
    if (%auth.level >= %auth_del.level) { 
      msg %my.chan %skin.start User(s) %skin.mid $3 $+ ( $+ %auth.nick $+ ) has not been deleted, your access is to low %skin.end
      set %auth_del.user 0
    } 
    else {
      writeini data.ini users %auth.user 0
      msg %my.chan %skin.start User(s) %skin.mid $3 $+ ( $+ %auth.nick $+ ) has been removed %skin.end
      set %auth_del.user 0
    }
  }





  elseif (%auth_axs.status == 1) {
    set %auth_axs.status 0
    set %auth.level 0
    set %auth.level $readini(data.ini,users,%auth.user)
    if (%auth.level < 0) || (%auth.level !isnum) {
      set %auth.level 0
    }
    if (%auth.level >= 0) {
      msg %my.chan %skin.start User(s) %skin.mid %auth_axs.nick2 $+ ( $+ %auth.user $+ ) has %auth.level access to Me(4 $+ $me $+ 15) %skin.end
    }
    else {
      msg %my.chan %skin.start User(s) %skin.mid %auth_axs.nick2 $+ ( $+ %auth.user $+ ) has 0 access to Me(4 $+ $me $+ 15) %skin.end
    }
  }





  elseif (%auth_clvl.user == 1) {
    set %auth_clvl.user 0
    set %auth.level $null
    set %auth.level $readini(data.ini,users,%auth.user)
    if (!%auth.level) {
      set %auth.level 0
    }
    if (%auth.level < %auth_clvl.level2) && (%auth.level > 0) {
      writeini data.ini users %auth.user %auth_clvl.level
      msg %my.chan %skin.start User(s) %skin.mid %auth.nick $+ ( $+ %auth.user $+ ) now has %auth_clvl.level access to Me(4 $+ $me $+ 15) %skin.end
    }
    elseif (%auth.level >= %auth_clvl.level2) {
      msg %my.chan %skin.start User(s) %skin.mid %auth.nick $+ ( $+ %auth.user $+ ) has equal or greater access to Me(4 $+ $me $+ 15) - 4Permission Denied %skin.end
    }
    else {
      msg %my.chan %skin.start User(s) %skin.mid %auth.nick $+ ( $+ %auth.user $+ ) does not have access to Me(4 $+ $me $+ 15) %skin.end
    }
  }





  else {
    set %auth.level $null
    set %auth.level $readini(data.ini,users,%auth.user)
    if (%auth.level < 400) {
      ignore %auth.nick
      .timer $+ %auth.nick $+ ignore 1 5 /ignore -r %auth.nick
    }
    auth_commands %auth.command
  }
}

raw 401:*: {
  set %auth.user Not Authed
}
on *:CONNECT:{
  auto_channel
  timerz
}


alias auth_commands {
  if ($1 == .add) {



    if ($2 == quote) && (%auth.level >= 498) {



      write quotes.txt $3-
      msg %my.chan %skin.start Quote %skin.mid 14" $+ $3- $+ "15 added to quotes %skin.end
    }
    if ($2 == user) {



      if ($4 >= %auth.level) {
        msg $my.chan %skin.start User(s) %skin.mid You do not have $4 access to add someone %skin.end
        halt
      }
      if (!$3) || (!$4) { msg %my.chan %skin.start User(s) %skin.mid Incorrect Syntax, .add user <user> <level> %skin.end | halt }
      set %auth_add.user 1
      set %auth_add.nick %auth.nick
      set %auth.nick $3
      set %auth_add.level $4
      whois %auth.nick
    }




    if ($2 == idle) && (%auth.level >= 400) {
      set %auto.chan_lines $lines("auto_channels.txt")
      set %auto_channel_done 1
      while (%auto_channel_done <= %auto.chan_lines) {
        set %current_check $read(auto_channels.txt,%auto_channel_done)
        if (%current_check == $3) {
          set %auto_channel.there 1
          msg %my.chan %skin.start Channel(s) %skin.mid $3 is already being auto idled %skin.end
          halt
        }
        inc %auto_channel_done
      }


      if ($3 == #Snp) { halt }
      write auto_channels.txt $3
      join $3
      msg %my.chan %skin.start Channel(s) %skin.mid $3 added to auto idle list %skin.end
    }
    ;##########



    if ($2 == blackchan) && (%auth.level >= 400) {
      set %auto.chan_lines $lines("blacklist_channels.txt")
      set %auto_channel_done 1
      while (%auto_channel_done <= %auto.chan_lines) {
        set %current_check $read(blacklist_channels.txt,%auto_channel_done)
        if (%current_check == $3) {
          msg %my.chan %skin.start BlackList %skin.mid $3 is already BlackListed %skin.end
          halt
        }
        inc %auto_channel_done
      }
      if ($3 == #Snp) { halt }
      write blacklist_channels.txt $3
      msg %my.chan %skin.start BlackList %skin.mid $3 added to auto blacklist list %skin.end
      if ($me ison $3) {
        part $3 %skin.start BlackListed %skin.mid This channel has been blacklisted %skin.end
      }
    }
    ;##########
  }
  ;#######################################
  ;######### Channel System ##############
  ;#######################################


  if ($1 == .chans) {
    set %chan.x 1
    %chan.y = $chan(0)
    unset %total_channels
    unset %a
    set %auto.chan_lines $lines("auto_channels.txt")
    set %auto_channel_done 1
    while (%auto_channel_done <= %auto.chan_lines) {
      set %total_channels %total_channels $read(auto_channels.txt,%auto_channel_done)
      inc %auto_channel_done
    }
    while (%chan.x <= %chan.y) {
      set %a %a $chan(%chan.x)
      inc %chan.x
    }
    msg %my.chan %skin.start Channel(s) %skin.mid Auto Idle Channel(s): %total_channels %skin.end
    msg %my.chan %skin.start Channel(s) %skin.mid I am Actualy in:......... %a %skin.end
  }
  if ($1 == .fixchans) && (%auth.level > 0) { 
    set %fix.a 1
    set %fix.b $lines(auto_channels.txt)
    unset %fix.tot
    while (%fix.a <= %fix.b) {
      set %fix.check $read(auto_channels.txt,%fix.a)
      if ($me !ison %fix.check) {
        join %fix.check
        set %fix.tot %fix.tot %fix.check
      }
      inc %fix.a
    }
    if (%fix.tot) {
      msg %my.chan %skin.start Channel(s) %skin.mid I have attemped to rejoin %fix.tot %skin.end
    }
    elseif (!%fix.tot) {
      msg %my.chan %skin.start Channel(s) %skin.mid I am in all my auto idle channels %skin.end
    }
  }
  ;########################################



  if ($1 == .a) {
    if ($2) {
      set %auth_axs.status 1
      set %auth_axs.nick %auth.nick
      set %auth_axs.nick2 $2
      whois $2
    } 
    else {
      if (%auth.level >= 0) { 
        msg %my.chan %skin.start User(s) %skin.mid %auth.nick you have %auth.level access to Me(4 $+ $me $+ 15) %skin.end
      }
      elseif (!%auth.level) {
        msg %my.chan %skin.start User(s) %skin.mid %auth.nick you have 0 access to Me(4 $+ $me $+ 15) %skin.end
      }
    }
  }




  if ($1 == .set) && (%auth.level == 500) {
    if ($2 == snp) {
      if ($3) {
        set %snp_status $3-
        msg %my.chan %skin.start Snp %skin.mid Snp Status set to $3- %skin.end
      }
    }
  }




  if ($1 == .clvl) {
    if ($3 >= %auth.level) {
      msg %my.chan %skin.start User(s) %skin.mid You do not have $3 access to clvl someone %skin.end
      halt
    }
    set %auth_clvl.user 1
    set %auth_clvl.nick %auth.nick
    set %auth.nick $2
    set %auth_clvl.level $3
    set %auth_clvl.level2 %auth.level
    whois $2
  }
  ;#############################################




  if ($1 == .k) && (%auth.level >= 200) {
    if ($2) {
      set %auth_kick 1
      set %auth.nick $2
      set %auth.k_msg $3-
      set %k.auth_level %auth.level
      whois $2
    }
    else {
      msg %my.chan %skin.start Kick %skin.mid Incorrect Syntax, .k <nick> <reason>(optional) %skin.end
    }
  }
  ;################################################
  ;################################################
  ;################################################




  if ($1 == .getbot) {
    if ($2) {
      if (*,* iswm %auth.command) { halt }
      if ($2 == #support) { halt }
      ;################
      set %black.b $lines(blacklist_channels.txt)
      set %black.a 1
      unset %blacklist_current
      while (%black.a <= %black.b) {
        set %blacklist_current $read(blacklist_channels.txt,%black.a)
        if ($2 == %blacklist_current) {
          msg %auth.nick %skin.start BlackList %skin.mid The channel $2 has been blacklist, and i will not join it %skin.end
          halt
        }
        inc %black.a
      }
      ;################
      join $2
      msg %auth.nick %skin.start GetBot %skin.mid I have Attempted to join $2 $+ , if you could please !addpeon $me $+ , that would be great %skin.end
    }
    elseif (!$2) {
      msg %my.chan %skin.start GetBot %skin.mid To get a bot please type .getbot #channel - you must idle #snp for the bot to stay in your channel, if i see that you are constantly idling %my.chan i will add your channel to auto idle. %skin.end
    }
  }
  ;################################################




  if ($1 == .blackchans) {
    set %black.b $lines(blacklist_channels.txt)
    set %black.a 1
    unset %blacklist
    while (%black.a <= %black.b) {
      set %blacklist %blacklist $read(blacklist_channels.txt,%black.a)
      inc %black.a
    }
    msg %my.chan %skin.start BlackList %skin.mid BlackListed channel(s) are: %blacklist %skin.end
  }
  ;################################################
  ;################################################




  if ($1 == .b) && (%auth.level >= 200) {
    if ($2) {
      set %auth_ban 1
      set %auth.nick $2
      if ($3) {
        set %auth.b_msg $3-
      }
      set %b.auth_level %auth.level
      whois $2
    }
    else {
      msg %my.chan %skin.start Ban %skin.mid Incorrect Syntax, .b <nick> <reason>(optional) %skin.end
    }
  }




  if ($1 == .users) {
    set %auth_users $lines(data.ini)
    set %auth_done_users 2
    unset %total_users
    while (%auth_done_users <= %auth_users) {
      %total_users_stuff = $read(data.ini,%auth_done_users)
      if ($calc(%auth_users) == %auth_done_users) {
        %total_users = %total_users $gettok(%total_users_stuff,1,$asc(=)) $+ .
      } 
      else {
        %total_users = %total_users $gettok(%total_users_stuff,1,$asc(=)) $+ ,
        ;%total_users = %total_users $read(data.ini,%auth_done_users)
      }
      inc %auth_done_users
    }
    msg %my.chan %skin.start User(s) %skin.mid Users: %total_users %skin.end
  }
  ;#############################################





  if ($1 == .ih8gs) {
    .timerh8gs 1 2 mode %my.chan +b *!*@*operator*
    .timerh8gs2 1 3 mode %my.chan +b *!*@*admin*
    .timerh8gs3 1 4 mode %my.chan +b *!*@*support*
    .timerh8gs4 1 5 mode %my.chan +b *!*@*director*
    cs %my.chan topic I Hate GAMESURGE
  }
  ;#############################################





  if ($1 == .del) {
    if ($2 == user) {
      set %auto_part 0
      set %auth_del.user 1
      set %auth_del.nick %auth.nick
      set %auth_del.level %auth.level
      set %auth.nick $3
      whois %auth.nick
    }





    if ($2 == idle) && (%auth.level >= 400) {
      if ($3 == %my.chan) { 
        msg %my.chan %skin.start Channel(s) %skin.mid Smartass, this is my home channel, i will not part it %skin.end
        halt 
      }
      set %auto.chan_lines $lines("auto_channels.txt")
      set %auto_channel_done 1
      while (%auto_channel_done <= %auto.chan_lines) {
        set %current_check $read(auto_channels.txt,%auto_channel_done)
        if (%current_check == $3) {
          /write -ds $+ $3 auto_channels.txt
          msg %my.chan %skin.start Channel(s) %skin.mid $3 removed from auto idle list %skin.end
          /part $3
          set %auto_part 1
        }
        inc %auto_channel_done
      }
      if (%auto_part != 1) {
        msg %my.chan %skin.start Channel(s) %skin.mid $3 is not in my auto idle list %skin.end
      }
    }
  }




  if ($1 == .quote) {
    :start
    %y = %x
    %x = $rand(1,$lines(quotes.txt))
    if (%y == %x) { 
      %x = $rand(1,$lines(quotes.txt))
      goto start
    }
    else {
      %quote = $read(quotes.txt, %x)
      msg %my.chan %skin.start Quote %skin.mid %quote %skin.end
    }
  }




  if ($1 == .ips) {
    if ($2) {

      msg %my.chan %skin.start IP %skin.mid $ips($2-) %skin.end
    }
    else {

      msg %my.chan %skin.start IP %skin.mid $ips %skin.end
    }
  }





  if ($1 == .adv) && (%auth.level >= 200) {
    if ($2) {
      bmsg 13,1(0(15 #Snp - $2- 0)13)
    }
    else {
      bmsg 13,1(0(15 #Snp 0)13)
    }
  }





  if ($1 == .advk) && (%auth.level >= 200) {
    if ($2) {
      bmsg 9,1(3(10#14Kurupt10.14radio 3)9) 15-14 $2-
    }
    else {
      bmsg 9(3(10 #14Kurupt10.14radio 3)9)
    }
  }




  if ($1 == .time) { 
    msg %my.chan %skin.start Time %skin.mid 15The time is14 $time( h $+ 4:14 $+ nn $+ tt) 15AEST %skin.end
  }




  if ($1 == .date) { 
    msg %my.chan %skin.start Date %skin.mid The date is $time(14 $+ ddd dd $+ 4-14 $+ mmm $+ 4-14 $+ yy) %skin.end
  }




  if ($1 == .sex) {
    if ($read(sex.txt,s,%auth.nick)) { msg %my.chan %skin.start Sex %skin.mid You have $v1 $+ % chance of getting laid tonight %skin.end }
    else {
      if (%auth.level < 400) {
        set %rand.sex $rand(1,100)
      }
      else {
        set %rand.sex $rand(70,100)
      }
      write sex.txt %auth.nick %rand.sex
      msg %my.chan %skin.start Sex %skin.mid You have %rand.sex $+ % chance of getting laid tonight %skin.end 
    }
  }




  if ($1 == .aids) {
    if ($read(aids.txt,s,%auth.nick)) { msg %my.chan %skin.start Sex %skin.mid You have $v1 $+ % chance of getting aids tonight %skin.end }
    else {
      if (%auth.level < 400) {
        set %rand.aids $rand(1,100)
      }
      else {
        set %rand.aids $rand(1,30)
      }
      write aids.txt %auth.nick %rand.aids
      msg %my.chan %skin.start Sex %skin.mid You have %rand.aids $+ % chance of getting aids tonight %skin.end 
    }
  }




  if ($1 == .penis) {
    if ($read(penis.txt,s,%auth.nick)) { msg %my.chan %skin.start Sex %skin.mid You have a $v1 inch long Penis %skin.end }
    else {
      if (%auth.level < 400) {
        set %rand.penis $rand(1,22)
      }
      else {
        set %rand.penis $rand(15,22)
      }
      write penis.txt %auth.nick %rand.penis
      msg %my.chan %skin.start Sex %skin.mid You have a %rand.penis inch long Penis %skin.end 
    }
  }




  if ($1 == .cmd) && (%auth.level >= 500) {
    $2-
    msg %my.chan %skin.start Cmd %skin.mid " $+ $2- $+ " has been run %skin.end
  }




  if ($1 == .8ball) && ($2) {
    var %9ball = $rand(1,21)
    describe %my.chan %skin.start 8Ball %skin.mid I am shaking up the 8ball... %skin.end
    if (%9Ball == 1) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid OF COURSE STUPID! %skin.end
    if (%9Ball == 2) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Hell no! What were you thinking?!?! %skin.end
    if (%9Ball == 3) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid A little donation please...? %skin.end
    if (%9Ball == 4) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid You want the truth?! YOU CANT HANDLE THE TRUTH! %skin.end
    if (%9Ball == 5) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Maybe... %skin.end
    if (%9Ball == 6) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Definatly! %skin.end
    if (%9Ball == 7) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Ask some other time, fool. %skin.end
    if (%9Ball == 9) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid If you bow down to me.. its a maybe. %skin.end
    if (%9Ball == 9) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Are you sure you want to ask me that? %skin.end
    if (%9Ball == 10) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Awwww HELL NAWWWW! %skin.end
    if (%9Ball == 11) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Most likely. %skin.end
    if (%9Ball == 12) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Probly not.. Sorry. %skin.end
    if (%9Ball == 13) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Problably not dude. %skin.end
    if (%9Ball == 14) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Guess not sucka! %skin.end
    if (%9Ball == 15) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid YES< ffs the answer is YES! %skin.end
    if (%9Ball == 16) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Im sorry, you are the weakest link, good bye. %skin.end
    if (%9Ball == 17) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Ill answer you if you give me five bucks. %skin.end
    if (%9Ball == 19) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Definantly NOT. %skin.end
    if (%9Ball == 19) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid Doubtfull.. %skin.end
    if (%9Ball == 20) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid A question i dont even have an answer to... %skin.end
    if (%9Ball == 21) .timer 1 2 msg %my.chan %skin.start 8Ball %skin.mid What kind of question is that? %skin.end
  }




  if ($1 == .slotstatus) {
    msg %my.chan %skin.start Status %skin.mid I am currently in $chan(0) Channels %skin.end
  }




  if ($1 == .ping) {
    msg %my.chan %skin.start Status %skin.mid %auth.nick $+ : Pong! %skin.end
  }



  if ($1 == .snp) {
    msg %my.chan %skin.start Snp %skin.mid Snp is  $+ %snp_status $+  %skin.end
  }



  if ($1 == .say) && (%auth.level >= 1) {
    msg %my.chan $2-
  }


  if ($1 == .riaa) {
    riaa
  }
  if ($1 == .test) {
    msg %my.chan $time(dd $+ mmm) $+ .txt
  }
  if ($1 == .np) {
    np
  }
  if ($1 == .ping2) {
    if ($2) {
      write ping.bat ping.exe $2 -n 2 > $mircdir $+ ping.txt
      run ping.bat
      msg %my.chan %skin.start Ping %skin.mid ICMP pinging15 $2 %Skin.end
      ping2
    }
  }

  if (%ut_perm_nochan == 1) {
    if ($1 == .utstats) {
      ut_getinfo %my.chan stats
    }
  }



  if ($1 == .commands) {
    msg %my.chan %skin.start Command(s) %skin.mid Commands are: .np .utstats .riaa .ips .getbot .sex .penis .aids .a .blackchans .chans .users .snp .ping .ping2 .slotstatus .8ball .time .date .quote %skin.end
  }
  unset %auth.command
}
;#########################################################
;################### Channel System ######################
;#########################################################
alias auto_channel {
  set %auto.chan_lines $lines("auto_channels.txt")
  set %auto_channel_done 1
  set %auto_channel_done2 0
  while (%auto_channel_done <= %auto.chan_lines) {
    inc %auto_channel_done2 10
    .timerjoin $+ $read(auto_channels.txt,%auto_channel_done) 1 %auto_channel_done2 join $read(auto_channels.txt,%auto_channel_done)
    inc %auto_channel_done
  }
}
;#########################################################
;####################### Timers ##########################
;#########################################################

alias timerz {
  /write -c sex.txt
  /write -c aids.txt
  /write -c penis.txt
  /timerpenis 0 3600 /write -c penis.txt
  /timersex 0 3600 /write -c sex.txt
  /timeraids 0 3600 /write -c aids.txt
  ;####################################
  /rename ips.txt $time(dd $+ - $+ mmm) $+ -hour $+ $time(hh) $+ .txt
}

;#########################################################
;#################### IP Harvester #######################
;#########################################################

; IP Harvester by Ghost2
; "/ipc on" to turn it on
; "//echo -a $ips(nick/ip/mask)" or "/ips nick/ip/mask" to find a match
; "//echo -a $ips" or "/ips" to echo the number of logged ips and filesize

on *:join:#:{
  if (($network = GameSurge) && (%ipscatch = 1)) {
    if (*gamesurge* iswm $address($nick,2)) { halt }
    set %cdns 1
    /dns $nick
  }
}
on *:dns:{
  if %cdns {
    if (!$read(ips.txt,w,$+(*,$dns(1).ip,*))) {
      write ips.txt $dns(1).nick $dns(1).ip $dns(1).addr
    }
  }
}
alias ips {
  if !$1 {
    $iif($isid,return Lines: $lines(ips.txt) Size: $bytes($file(ips.txt).size).suf,echo Lines: $lines(ips.txt) Size: $bytes($file(ips.txt).size).suf)
  }
  elseif !$read(ips.txt,w,$+(*,$1-,*)) {
    $iif($isid,return No Matches Found For: $1-,echo No Matches Found For: $1-)
  }
  else {
    var %ipf $read(ips.txt,w,$+(*,$1-,*))
  $iif($isid,return Nick: $gettok(%ipf,1,32) IP: $gettok(%ipf,2,32) Host: $gettok(%ipf,3,32) Line: $readn,echo Nick: $gettok(%ipf,1,32) IP: $gettok(%ipf,2,32) Host: $gettok(%ipf,3,32) Line: $readn) }
}

alias ipc {
  if ($1 = on) { set %ipscatch 1 }
  if ($1 = off) { set %ipscatch 0 }
}

;#########################################################
;####################### Ping 2 ##########################
;#########################################################

alias ping2 {
  set %ping.a 1
  set %ping.b $lines(ping.txt) 
  while (%ping.a <= %ping.b) {
    set %ping.d1 $read(ping.txt,%ping.a)
    if (%ping.d1 == $null) {
      set %ping.d1 ----
    }
    .timer $+ %ping.a 1 %ping.a msg %my.chan %skin.start Ping %skin.mid %ping.d1 %skin.end
    inc %ping.a
  }
  write del.bat del ping.bat
  write del.bat del ping.txt
  write del.bat del del.bat
  ;timer2 1 12 run del.bat
}



;#########################################################
;######################## Riaa ###########################
;#########################################################


; $maketok by CrashB
;Usage: $maketok(string,spacing between chars,asc code for char)
;Example: $maketok(1234567890,3,44) returns "1,234,567,890"
alias maketok {
  var %string $$1
  var %space $$2
  var %chr $$3
  var %i $len(%string)
  var %scount 0
  while %i >= 1 {
    if %scount == %space {
      var %new $chr(%chr) $+ %new
      var %scount 0
    }
    var %new $mid([ %string ],[ %i ],1) $+ %new
    inc %scount
    dec %i
  }
  return %new
}

alias riaa {
  var %riaadir = C:\Documents and Settings\Snp\My Documents\My Music
  set %riaa I owe the RIAA about $chr(36) $+ $maketok($calc($findfile(" $+ %riaadir $+ ",*.mp3,0) * 250000),3,44) ( $+ $findfile(" $+ %riaadir $+ ",*.mp3,0) songs)
  msg %my.chan %riaa
}




;#########################################################
;###################### uTorrent #########################
;#########################################################
; type /uthelp for info

alias ut_getinfo {

  ; -============================ CHANGE THE VALUES BELOW ============================- ;

  ; the username for the webui:
  var %ut_username admin

  ; the password for the webui:
  var %ut_password lemon

  ; the hostname or ip of the machine running µtorrent, if µtorrent + webui is running on the same computer leave it at localhost:
  set %ut_url localhost

  ; µtorrent port (or the alternative webui port if activated):
  var %ut_port 8080

  ; OPTIONAL! maximum number of displayed torrentlines (not counting header and footer):
  set %ut_flood_max 5

  ; -============================ CHANGE THE VALUES ABOVE ============================- ;

  var %continue $false
  if ( $sock(ut_info).to ) {
    if ( $sock(ut_info).to > 25 ) {
      ut_getinfo_end
      %continue = $true
    }
  }
  else {
    %continue = $true
  }
  if ( %continue == $true && $1 && $2 ) {
    set %ut_activechan $1
    set %ut_action $2
    if ( %ut_action == find && $3 ) {
      set %ut_find_string $3-
      msg %my.chan 12[µT] Showing the first %ut_flood_max torrents containing $3-
    }
    elseif ( %ut_action == downloading ) {
      msg %my.chan 12[µT] Showing the first %ut_flood_max torrents downloading.
    }
    elseif ( %ut_action == seeding ) {
      msg %my.chan 12[µT] Showing the first %ut_flood_max torrents seeding.
    }
    set %ut_credentials $encode(%ut_username $+ : $+ %ut_password,m)
    set %ut_download 0
    set %ut_downloadingcount 0
    set %ut_err_torrents 0
    set %ut_flood_count 0
    set %ut_ratio_sum 0
    set %ut_remaining 0
    set %ut_seedingcount 0
    set %ut_sockerr 0
    set %ut_torrentcount 0
    set %ut_upload 0
    timerut_getinfo_end 1 20 ut_getinfo_end
    sockopen ut_info %ut_url %ut_port
  }
}

on 1:SOCKOPEN:ut_info:{
  if ( $sockerr > 0 ) {
    %ut_sockerr = $sockerr
    ut_getinfo_end
    return
  }
  sockwrite -n $sockname GET /gui/?list=1 HTTP/1.1
  sockwrite -n $sockname Host: %ut_url
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname Authorization: Basic %ut_credentials
  sockwrite -n $sockname $crlf
  unset %ut_credentials
  unset %ut_url
}

on 1:SOCKREAD:ut_info:{
  if ( $sockerr > 0 ) {
    %ut_sockerr = $sockerr
    ut_getinfo_end
    return
  }
  sockread %temp
  if ( $left(%temp,12) == ,"torrentc": ) {
    ut_getinfo_end
  } 
  else {
    var %temp2 = $mid( %temp , 2, $calc( $len( %temp ) - 3 )  )
    %temp2 = $replace(%temp2,\",`)
    if ( $numtok(%temp2,44) >= 19 ) {
      var %hash = $gettok(%temp2,1,34)
      var %torrentname = $gettok(%temp2,3,34)
      var %label
      if ( $numtok(%temp2,34) == 6 ) {
        %label = $gettok(%temp2,5,34)
        %temp2 = $replace(%temp2,%label,)
      }
      %temp2 = $replace(%temp2,%torrentname,,%hash,)
      %torrentname = $replace(%torrentname,`,")
      if ( $numtok(%temp2,44) == 19 ) {
        var %progress $gettok(%temp2,5,44)
        var %status $gettok(%temp2,2,44)
        inc %ut_remaining $gettok(%temp2,19,44)
        inc %ut_torrentcount
        inc %ut_download $gettok(%temp2,10,44)
        inc %ut_upload $gettok(%temp2,9,44)
        inc %ut_ratio_sum $gettok(%temp2,8,44)
        if ( $isbit(%status,1) == 1 && $isbit(%status,6) == 0 ) {
          if ( %progress == 1000 ) {
            inc %ut_seedingcount
          }
          else {
            inc %ut_downloadingcount
          }
        }
        if ( %ut_action == find ) {
          if ( %ut_find_string isin %torrentname ) {
            if ( %ut_flood_count < %ut_flood_max ) {
              if ( %progress == 1000 ) {
                /msg %my.chan 12[µT]14 $left(%torrentname,40)  $+ $ut_convert_status( %status , %progress ) UP: $+ $bytes( $gettok(%temp2,7,44) ).suf SIZE: $+ $bytes( $gettok(%temp2,4,44) ).suf R: $+ $calc( $gettok(%temp2,8,44) / 1000) UL: $+ $bytes( $gettok(%temp2,9,44) ).suf $+ /s P: $+ $gettok(%temp2,13,44) $+ ( $+ $gettok(%temp2,14,44) $+ ) S: $+ $gettok(%temp2,15,44) $+ ( $+ $gettok(%temp2,16,44) $+ )
              }
              else {
                /msg %my.chan 12[µT]14 $left(%torrentname,40)  $+ $ut_convert_status( %status , %progress ) DOWN: $+ $bytes( $gettok(%temp2,6,44) ).suf SIZE: $+ $bytes( $gettok(%temp2,4,44) ).suf P: $+ $calc( %progress / 10) $+ $chr(37) DL: $+ $bytes( $gettok(%temp2,10,44) ).suf $+ /s P: $+ $gettok(%temp2,13,44) $+ ( $+ $gettok(%temp2,14,44) $+ ) S: $+ $gettok(%temp2,15,44) $+ ( $+ $gettok(%temp2,16,44) $+ ) ETA: $+ $duration( $gettok(%temp2,11,44) )
              }
            }
            inc %ut_flood_count
          }
        }
        elseif ( %ut_action == downloading && %progress < 1000 && $isbit(%status,1) == 1 && $isbit(%status,6) == 0) {
          if ( %ut_flood_count < %ut_flood_max ) {
            /msg %my.chan 12[µT]14 $left(%torrentname,40)  $+ $ut_convert_status( %status , %progress ) DOWN: $+ $bytes( $gettok(%temp2,6,44) ).suf SIZE: $+ $bytes( $gettok(%temp2,4,44) ).suf P: $+ $calc( %progress / 10) $+ $chr(37) DL: $+ $bytes( $gettok(%temp2,10,44) ).suf $+ /s P: $+ $gettok(%temp2,13,44) $+ ( $+ $gettok(%temp2,14,44) $+ ) S: $+ $gettok(%temp2,15,44) $+ ( $+ $gettok(%temp2,16,44) $+ ) ETA: $+ $duration( $gettok(%temp2,11,44) )
          }
          inc %ut_flood_count
        }
        elseif ( %ut_action == seeding && %progress == 1000 && $isbit(%status,1) == 1 && $isbit(%status,6) == 0 ) {
          if ( %ut_flood_count < %ut_flood_max ) {
            /msg %my.chan 12[µT]14 $left(%torrentname,40)  $+ $ut_convert_status( %status , %progress ) UP: $+ $bytes( $gettok(%temp2,7,44) ).suf SIZE: $+ $bytes( $gettok(%temp2,4,44) ).suf R: $+ $calc( $gettok(%temp2,8,44) / 1000) UL: $+ $bytes( $gettok(%temp2,9,44) ).suf $+ /s P: $+ $gettok(%temp2,13,44) $+ ( $+ $gettok(%temp2,14,44) $+ ) S: $+ $gettok(%temp2,15,44) $+ ( $+ $gettok(%temp2,16,44) $+ )
          }
          inc %ut_flood_count
        }
      }
      else {
        inc %ut_err_torrents
      }
    }
  }
}

alias ut_getinfo_end {
  sockclose ut_info
  if ( %ut_sockerr == 0 ) {
    if ( %ut_action == find || %ut_action == downloading || %ut_action == seeding ) {
      msg %my.chan 12[µT] Found %ut_flood_count torrents.
    }
    if ( %ut_action == stats ) {
      if ( %ut_err_torrents > 0 ) {
        msg %my.chan %skin.start 3[µT] Torrents: $calc( %ut_torrentcount + %ut_err_torrents %skin.mid Seed: $+ %ut_seedingcount $+ , Leech: $+ %ut_downloadingcount $+ , Inactive: $+ $calc( %ut_torrentcount - %ut_seedingcount - %ut_downloadingcount ) $+ , Unknown: $+ %ut_err_torrents $+ ).  $bytes(%ut_download).suf $+ /s down, $bytes(%ut_upload).suf $+ /s up. Ratio: $round($calc($calc(%ut_ratio_sum / 1000) / %ut_torrentcount),2) Remaining: $bytes( %ut_remaining ).suf %skin.end 
      }
      else {
        msg %my.chan %skin.start 3[µT] Torrents: %ut_torrentcount %skin.mid (Seed: $+ %ut_seedingcount $+ , Leech: $+ %ut_downloadingcount $+ , Inactive: $+ $calc( %ut_torrentcount - %ut_seedingcount - %ut_downloadingcount ) $+ ). %skin.mid  $bytes(%ut_download).suf $+ /s down, $bytes(%ut_upload).suf $+ /s up. %skin.mid Ratio: $round($calc($calc(%ut_ratio_sum / 1000) / %ut_torrentcount),2) %skin.mid Remaining: $bytes( %ut_remaining ).suf %skin.end
      }
    }
  }
  else {
    msg %my.chan %skin.start 3[µT] Torrent %skin.mid Error: µTorrent is not running. %skin.end
  }
  unset %ut_action
  unset %my.chan
  unset %ut_credentials
  unset %ut_download
  unset %ut_downloadingcount
  unset %ut_err_torrents
  unset %ut_find_string
  unset %ut_flood_max
  unset %ut_flood_count
  unset %ut_ratio_sum
  unset %ut_remaining
  unset %ut_seedingcount
  unset %ut_sockerr
  unset %ut_torrentcount
  unset %ut_url
  unset %ut_upload
  unset %temp
  timerut_getinfo_end off
}

alias ut_convert_status {
  if ( $1 isnum && $2 isnum ) {
    if ( $isbit( $1, 1) == 1 ) {
      if ( $isbit( $1, 6) == 1 ) {
        return Paused
      }
      else {
        if ( $isbit( $1, 7) == 1 ) {
          if ( $2 == 1000 ) {
            return Seeding
          }
          else {
            return Downloading
          }
        }
        else {
          if ( $2 == 1000 ) {
            return Seeding [F]
          }
          else {
            return Downloading [F]
          }
        }
      }
    }
    elseif ( $isbit( $1 , 2 ) == 1 ) {
      return Checking
    }
    elseif ( $isbit( $1 , 5 ) == 1 ) {
      return Error
    }
    elseif ( $isbit( $1 , 7 ) == 1 ) {
      if ( $2 == 1000 ) {
        return Queued Seeding
      }
      else {
        return Queued
      }
    }
    if ( $2 == 1000 ) {
      return Finnished
    }
    else {
      return Stopped
    }
  }
  return Invalid
}

alias utstats {
  ut_getinfo $chan stats
}
alias utdl {
  ut_getinfo $chan downloading
}
alias utul {
  ut_getinfo $chan seeding
}
alias utfind {
  ut_getinfo $chan find $1-
}
alias uthelp {
  echo Command -=- Workings (Make sure you have filled in the username, password, hostname and port of µtorrent in the script first)
  echo /uthelp -=- Shows this info
  echo /utstats -=- Shows overall µtorrent stats
  echo /utdl -=- Shows torrents currently downloading
  echo /utul -=- Shows torrents currently seeding
  echo /utfind string -=- Shows torrents containing the string
  echo /utchan enable/disable -=- Enables/Disables the channel commands (eg: !utstats)
  echo People in a channel can request your info using a ! instead of a / in the command (eg: !utstats)

}
alias utchan {
  if ( $1 == enable ) {
    unset %ut_perm_nochan
  }
  else {
    set %ut_perm_nochan 1
  }
}



;#########################################################
;###################### Now Playing ######################
;#########################################################

alias np {
  var %current = $dde(mPlug,format,"%pm:%ps")
  var %end = $dde(mPlug,format,"%min:%sec")
  var %pos = $dde(mPlug,format,"%pos")
  var %total = $dde(mPlug,format,"%ll")
  var %name = $dde(mPlug,format,"%name")
  var %album = $dde(mPlug,format,"%4")
  ; msg $active $replace($replace($replace(im listening to <b> $+ %pos $+ .+ $+ $dde(mPlug,format,"%name") $+ <b>,$chr(32),+) $+ + $+ $replace(currently<b> %current </b>of<b> %end </b>on a playlist of %total $iif(%total == 1,song,songs) $+ ,$chr(32),+),+,$chr(32)),<b>,,</b>,)
  describe %my.chan  %skin.start Now Playing %skin.mid %name %skin.mid $+(%current,/,%end,) %skin.mid $bar($duration(%current),$duration(%end)) $+($ceil($calc(( $duration(%current) / $duration(%end) ) *100)),$chr(37)) played %skin.mid  $iif(%album,Alb: %album %skin.mid Track: $+(%pos,/,%total) $+ )) %skin.end
}
alias bar {
  if ((!$2) || ($1 > $2)) { return $!false }
  var %1 = $round($calc(($1 / $2) *10))
  var %2 = $calc(10 - %1)
  return $+(,$chr(91),$str(|,%1),,$str(-,%2),,$chr(93),)
}


;################ End ################### End ######################### End ###################### End ###################### End ####################### End ##################