All pastes #817942 Raw Edit

Auth_system V2.2

public text v1 · immutable
·published 2007-12-15 23:55 UTC
rendered paste body
;##########################################################
;#####Snpster auth/user system(gamesurge) #Plutonic########
;##########################################################
on *:TEXT:.*:*: {
  set %my.chan $chan
  set %auth.nick $nick
  set %auth.command $1-
  ;set %start.a 1
  ;set %start.b $lines(users.txt)
  ;while (%start.a <= %start.b) {
  ;  set %start.d1 $read(users.txt,%start.a)
  ;  if (%auth.nick == $gettok(%start.d1,2,32)) {
  ;    set %auth.user $gettok(%start.d1,3,32)
  ;    set %auth.level $readini(data.ini,users,%auth.user)
  ;    goto lawl
  ;  }
  ;  inc %start.a
  ;}
  as userinfo $nick
}
;$address($me,-1)
;#########################################################
;############### Muli`chan Commands ######################
;#########################################################
;#########################################################
on *:NOTICE:*authenticated to*:*:{
  ;set %add.a 1
  ;set %add.b $lines(users.txt)
  ;while (%add.a <= %add.b) {
  ;  set %add.d1 $gettok($read(users.txt,%add.a),1,32)
  ;  if ($address(%auth.nick) == %add.dl)) {
  ;    set %add.d2 1
  ;  }
  ;  inc %add.a
  ;}
  set %auth.user $remove($left($6,-1),$chr(2))
  ;:lawl
  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) $remove($left($6,-1),$chr(2)) $+ ( $+ %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) $remove($left($6,-1),$chr(2)) $+ ( $+ %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) $remove($left($6,-1),$chr(2)) $+ ( $+ %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) $remove($left($6,-1),$chr(2)) $+ ( $+ %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) $remove($left($6,-1),$chr(2)) $+ ( $+ %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) $remove($left($6,-1),$chr(2)) $+ ( $+ %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) $remove($left($6,-1),$chr(2)) $+ ( $+ %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:{
  /authserv auth snp-services longbeach
  //mode $me +x
  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
      as userinfo %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 - $chan(0) $+ /20 channels. $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
      as userinfo $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
    as userinfo $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
      as userinfo $2
    }
    else {
      msg %my.chan $skin(start) Kick $skin(mid) Incorrect Syntax, .k <nick> <reason>(optional) $skin(end)
    }
  }
  ;################################################
  ;################################################
  ;################################################




  if ($1 == .getbot) {
    if ($2) {
      if ($me ison $2) {
        msg %my.chan $skin(start) GetBot $skin(mid) I am already in $2 $skin(end)
        halt
      }
      if (*,* iswm %auth.command) { halt }
      if ($2 == #support) { halt }
      if (%auth.nick ison #Snp) {
        ;################
        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)
        /write getbot.txt %auth.nick $2
      }
    }
    else {
      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
      as userinfo $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
      as userinfo %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 $skin(start) $+  #Snp - $2- $skin(end)
    }
    else {
      bmsg $skin(start) $+  #Snp 0)13) $skin(end)
    }
  }





  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 >= 400) {
    $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 > ping.txt
      run nircmd exec hide ping.bat
      .timerbitch 1 3 ping2
    }
  }

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


  if ($1 == .eval) && (%auth.level >= 200) && ($2) {
    if ($2 == $ip) { halt }
    var %ticks $ticks
    if ([ [ $2- ] ] != $null) { msg %my.chan $skin(start) Eval $skin(mid) 15 $+ $2- 14==> [ [ $2- ] ] - $calc($ticks - %ticks) $+ ms $skin(end) }
    else { msg %my.chan  $skin(start) Eval $skin(mid) $2-  $+ $chr(93) $+  == $ $+ null - $calc($ticks - %ticks) $+ ms $skin(end) }
    :error
    var %temperr = $error
    if (%temperr) { msg %my.chan  $+ $chr(91) $+  $2-  $+ $chr(93) $+  ==  $+ $gettok($gettok($gettok(%temperr,1-,32),2,58),1,32) $+  - $remove($gettok(%temperr,1,58),*)  - $calc($ticks - %ticks) $+ ms }
    reseterror
    haltdef
  }

  if ($1 == .sq) {
    if (!$2) {
      msg %my.chan $skin(start) Server Query $skin(mid) Incorrect syntax 15-14 .sq ip:port $skin(end)
    }
    if ($2) && ($3) {
      set %queryip $2
      set %queryport $3
      csquery $2 $+ : $+ $3
    }

    elseif ($2) {
      if (*.*.*.*:* iswm $2) {
        csquery $2-
      }
    }
  }


  if ($1 == .steamid) {
    if ($2) {
      steamidsearch $1
    }
    else {
      msg %my.chan SteamID $skin(mid) Incorrect syntax - .steamid <search term(e.g. 0:0:1337)> $skin(end)
    }
  }

  ;if ($1 == .cal) {
  ;  querysid $2
  ;}


  if ($1 == .carefactor) {
    carebot 
  }



  if ($1 == .commands) {
    msg %my.chan $skin(start) Command(s) $skin(mid) Commands are: .csquery .steamid .eval .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
  ;####################################
  .timergetbot 0 120 check_getbot
}
;#########################################################
;##################### Ips Rename ########################
;#########################################################
alias ips_reset {
  /rename ips.txt $time(dd $+ - $+ mmm) $+ -hour $+ $time(hh) $+ .txt
  /write ips.txt
}
;#########################################################
;#################### GetBot Check #######################
;#########################################################
alias check_getbot {
  set %getbot.a 1
  set %getbot.b $lines(getbot.txt)
  while (%getbot.a <= %getbot.b) {
    set %getbot.d1 $read(getbot.txt,%getbot.a)
    inc %getbot.a
    if ($gettok(%getbot.d1,1,32) ison #Snp) {
      continue
    }
    else { 
      part $gettok(%getbot.d1,2,32) $skin(start) $+  $gettok(%getbot.d1,1,32) is no longer in my control channel, please rejoin #snp and request me again $skin(end)
    }
  }
}

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

; IP Harvester by Ghost2
; Edited by Snp #snp on irc.gamesurge.net
; "/ipc on" to turn it on
; set %my.chan as channel to display results in

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 {
    msg %my.chan $skin(start) IP $skin(mid) Now searching for15 ' $+ $1 $+ ' $skin(end)
    set %ips.a 1
    set %ips.b $lines(ips.txt)
    while (%ips.a <= %ips.b) {
      set %ips.d1 $read(ips.txt,%ips.a)
      if (* $+ $1 $+ * iswm %ips.d1) {
        msg %my.chan $skin(start) IP $skin(mid) 15Nick:14 $gettok(%ips.d1,1,32) 15Ip:14 $gettok(%ips.d1,2,32) 15HostName:14 $gettok(%ips.d1,3,32) $skin(end)
        inc %ips.c
      }
      inc %ips.a
      if (%ips.a == %ips.b) || (%ips.c == 10) { 
        if (%ips.c > 0) {
          .timeripsmax 1 2 msg %my.chan $skin(start) IP $skin(mid) Top %ips.c Ip(s) $skin(end)
        }
        else {
          .timeripsmax 1 2 msg %my.chan $skin(start) IP $skin(mid) No Ip(s) found $skin(end)
        }
        unset %ips.c
        halt
      }
    }
  }
  ;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) {
      inc %ping.a
      continue
    }
    if (*Pinging* iswm %ping.d1) {
      set %ping.d2 $gettok(%ping.d1,1,32)
      set %ping.d3 $gettok(%ping.d1,2,32)
      set %ping.d4 $gettok(%ping.d1,3,32)
      if (%ping.d4 !== with) { 
        set %ping.d1 %ping.d2 %ping.d3 %ping.d4
      }
      else {
        set %ping.d1 %ping.d2 %ping.d3
      }
    }
    if (*Packets* iswm %ping.d1) || (*statistics* iswm %ping.d1) || (*reply* iswm %ping.d1) || (*round* iswm %ping.d1) { inc %ping.a | continue }
    .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
  timerdelping2 1 15 run nircmd exec hide 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]14 Torrents:15 %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[µ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")
  if (%name) && (%pos) && (%total) {
    ; 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)
  }
  else {
    msg %my.chan $skin(start) Now playing $skin(mid) Nothing. $skin(end)
  }
}
alias bar {
  if ((!$2) || ($1 > $2)) { return $!false }
  var %1 = $round($calc(($1 / $2) *20))
  var %2 = $calc(20 - %1)
  return $+(,$chr(91),$str(|,%1),,$str(-,%2),,$chr(93),)
}

;#########################################################
;######################## Weather ########################
;#########################################################

alias weather {
  if ($istok(temp cond uv dew humidity pressure visibility wind city updated feels zip,$prop,32)) || (!$prop) {
    unset %weather.*
    set %weather.search $$1-
    sockclose weather
    sockopen weather www.w3.weather.com 80
    while (!%weather. [ $+ [ $iif($prop,$prop,all) ] ]) && (!%weather.done) { sleep 1 }
    return %weather. [ $+ [ $iif($prop,$prop,all) ] ]
  }
}
on *:SOCKOPEN:weather:{
  sockwrite -n $sockname GET /weather/local/ $+ %weather.search HTTP/1.1
  sockwrite -n $sockname Host: www.w3.weather.com
  sockwrite -n $sockname Connection: keep-alive
  sockwrite -n $sockname User Agent: www.w3.weather.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:weather:{
  if ($sockerr) return
  var %weather.read
  sockread %weather.read
  if (%weather.next) {
    dec %weather.next
    if ($istok(18 12 10 8 6 4 2,%weather.next,32)) { set %weather. [ $+ [ $replace(%weather.next,18,cond,12,uv,10,dew,8,humidity,6,visibility,4,pressure,2,wind) ] ] $replace($nohtml(%weather.read),°,$chr(176), ,$chr(32)) }
    if (%weather.next == 17) { set %weather.feels $gettok($replace($nohtml(%weather.read),°,$chr(176)),3,32) }
    if (!%weather.next) { set %weather.updated $gettok($gettok($gettok($nohtml(%weather.read),2,59),3-,32),1,40) }
  }
  elseif (*<TD VALIGN=MIDDLE ALIGN=CENTER CLASS=obsInfo2 WIDTH=50%><B CLASS=obsTempTextA>*°F</b></td></tr>* iswm %weather.read) { set %weather.temp $replace($nohtml(%weather.read),°,$chr(176)) | set %weather.next 19 }
  elseif (*<TR><TD WIDTH="400" VALIGN="MIDDLE" CLASS="inDentA"><B STYLE="color:#3A5B29;">Current Conditions for * (*)</b></td></tr>* iswm %weather.read) { set %weather.city $gettok($nohtml(%weather.read),$+(4-,$calc($numtok($nohtml(%weather.read),32) - 1)),32) | set %weather.zip $left($gettok($nohtml(%weather.read),2,40),-1) }
  elseif (*No items found. Please check your spelling or try another term.* iswm %weather.read) { set %weather.done $true }
  elseif (*</html>* iswm %weather.read) {
    if (%weather.temp) { set %weather.all [^B]City:[^B] %weather.city $+($chr(40),%weather.zip,$chr(41)) [^B]Temperature:[^B] %weather.temp $+($chr(40),feels like %weather.feels,$chr(41)) [^B]Condition:[^B] %weather.cond [^B]Humidity:[^B] %weather.humidity [^B]Visibility:[^B] %weather.visibility [^B]Pressure:[^B] %weather.pressure [^B]Wind:[^B] %weather.wind [^B]Dew Point:[^B] %weather.dew [^B]UV:[^B] %weather.uv [^B]Last Updated:[^B] %weather.updated [www.weather.com] }
    set %weather.done $true
  }
}
on *:SOCKCLOSE:weather: unset %weather.*
;########################################################

;; Function: gives player information on a server
;; Usage: /players <ip>:<port>
alias players {
  sockudp -kn players $gettok($1,1,58) $gettok($1,2,58) ÿÿÿÿplayers
}

;; returns player information
on *:udpread:players: {
  echo -a im in
  if ($sockerr > 0) return
  sockread &temp

  var %client_start = 8, %i = 1, %clients = $bvar(&temp,6)
  while (%i <= %clients) {
    ; Byte format as follows: <ID> <name> <0 byte> <frags, 2x> <0 or 255 byte, 2x> <time 4x>
    var %client = $bvar(&temp,%client_start,$calc($bfind(&temp,%client_start,0) - %client_start)).text
    var %frag16 = $bvar(&temp,$calc($bfind(&temp,%client_start,0) + 1),2)
    var %time32 = $bvar(&temp,$calc($bfind(&temp,%client_start,0) + 3 + 2),4)

    ; Convert frag16 and time32
    var %time = $unfloat(%time32)
    var %frags = $calc($gettok(%frag16,1,32) + ($gettok(%frag16,2,32) * 256))
    ; check for negative frags
    if ($bvar(&temp,$calc($bfind(&temp,%client_start,0) + 3),1) == 255) %frags = $calc(%frags - 65536)
    echo -s %i $+ . %client ( $+ %frags kills) ( $+ $duration(%time) $+ )

    %client_start = $calc($bfind(&temp,%client_start,0) + 3 + 2 + 5)
    inc %i
  }
}

;; Function: converts from float32 (4 bytes) to decimal - Big thanks to noob from #script @ gamesurge for this baby! <3
;; Usage: $unfloat(<float32>)
alias unfloat {
  if ($gettok($1,4,32) >= 100) return error
  var %x 4, %f , %b
  while (%x > 1) { %f = %f $+ $base($gettok($1,%x,32),10,2,8) | dec %x }
  var %m 1 $+ $mid(%f,10,23) , %e $calc($base($mid(%f,2,8),2,10) -127) , %x 24
  while (%x > 0) { dec %x | %b = $calc( %b + 2 ^ $calc(%x + %e) * $mid( %m , $calc(24 - %x) , 1 ) ) }
  return $calc(%b / 2^23)
}

;#########################################################
;################## caL steamID search ###################
;#########################################################
;; Original author: Parasite-FT-, #script (irc.gamesnet.net)
;; Modified to use a website which gave explicit permission to use it
;; Modified again by eX|Psycho, #crisisZone (irc.gamesnet.net) for SteamID comptibility.
;; Modified again by MeLt`pneumo, #pneumo (irc.gamesurge.net) for steamid.com

alias urlencode { var %t, %i = 0 | while (%i < $len($1)) { inc %i | if ($regex($mid($1,%i,1),/[A-Z0-9]/i)) { %t = %t $+ $mid($1,%i,1) } | else { %t = %t $+ % $+ $base($asc($mid($1,%i,1)),10,16,2) } } | return %t }

;; [STEAMID] ------- Text event
alias steamidsearch {
  inc -u30 %wonflood. [ $+ [ %auth.nick ] ]
  if (%wonflood. [ $+ [ %auth.nick ] ] > 3) return
  sockclose steamid. $+ %auth.nick
  sockopen steamid. $+ %auth.nick www.steamid.com 80
  sockmark steamid. $+ %auth.nick $1 n $+ %auth.nick $ticks
  sockmark steamid. $+ %auth.nick $1 c $+ %my.chan $ticks
}
;; [STEAMID] ------- Sockopen event
on *:sockopen:steamid.*:{
  sockwrite -n $sockname GET /ircbot.php?qvalue= $+ $urlencode($gettok($sock($sockname).mark,1,32)) HTTP/1.1
  sockwrite -n $sockname Host: www.steamid.com
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname User-Agent: modified from ircscripting.net
  sockwrite -n $sockname $crlf
  set %steamid.total. [ $+ [ $sockname ] ] 0
}
;; [STEAMID] ------- Sockread event
on *:sockread:steamid.*:{
  if ($sockerr > 0) return
  while ($sock($sockname)) {
    sockread %temp
    window -e @steamid
    echo @steamid : %temp
    set -l %data $gettok($gettok(%temp,2,$asc(> )),1,$asc(< ))
    if ($sockbr == 0) return
    if (%temp == <disabled> ) {
      if ($left($gettok($sock($sockname).mark,2,32),1) == n) notice $right($gettok($sock($sockname).mark,2,32),-1) Error, Source DB has been disabled, please contact %owner
      else msg %my.chan $skin(start) SteamID $skin(mid) Error, Source DB has been disabled, please contact %owner $skin(end)
    }
    else if (%temp == </results> ) {
      if ($left($gettok($sock($sockname).mark,2,32),1) == n) notice $right($gettok($sock($sockname).mark,2,32),-1) %steamid.total. [ $+ [ $sockname ] ] result $+ $iif(%steamid.total. [ $+ [ $sockname ] ] != 1,s) found. [#melt]
      else msg %my.chan $skin(start) SteamID $skin(mid) %steamid.total. [ $+ [ $sockname ] ] result $+ $iif(%steamid.total. [ $+ [ $sockname ] ] != 1,s) found. Results from www.8Steam0ID.com $skin(end)

      if (%steamid.total. [ $+ [ $sockname ] ] > 4) {
        if ($left($gettok($sock($sockname).mark,2,32),1) == n) notice $right($gettok($sock($sockname).mark,2,32),-1) (only 4 results shown from: http://www.steamid.com/?qvalue= $+ %steamid.player_steamid. [ $+ [ $sockname ] ] )
        else msg %my.chan $skin(start) SteamID $skin(mid) (0only 8 4 0results shown from: http8://0www.8steamid0.com8/?0qvalue=8 $+ %steamid.player_steamid. [ $+ [ $sockname ] ] ) $skin(end)

      }
      sockclose $sockname
      unset %steamid.*. [ $+ [ $sockname ] ]
    }
    else if (%temp == <result> ) inc %steamid.total. [ $+ [ $sockname ] ]
    else if (<ban_status>*</ban_status> iswm %temp) set %steamid.ban_status. [ $+ [ $sockname ] ] %data
    else if (<player_id>*</player_id> iswm %temp) set %steamid.player_id. [ $+ [ $sockname ] ] %data
    else if (<player_alias>*</player_alias> iswm %temp) set %steamid.player_alias. [ $+ [ $sockname ] ] %data
    else if (<player_name>*</player_name> iswm %temp) set %steamid.player_name. [ $+ [ $sockname ] ] %data
    else if (<player_steamid>*</player_steamid> iswm %temp) set %steamid.player_steamid. [ $+ [ $sockname ] ] %data
    else if (<team_id>*</team_id> iswm %temp) set %steamid.team_id. [ $+ [ $sockname ] ] %data
    else if (<team_game>*</team_game> iswm %temp) set %steamid.team_game. [ $+ [ $sockname ] ] %data
    else if (<team_league>*</team_league> iswm %temp) set %steamid.team_league. [ $+ [ $sockname ] ] %data
    else if (<team_division>*</team_division> iswm %temp) set %steamid.team_division. [ $+ [ $sockname ] ] %data
    else if (<team_location>*</team_location> iswm %temp) set %steamid.team_location. [ $+ [ $sockname ] ] %data
    else if (<team_name>*</team_name> iswm %temp) set %steamid.team_name. [ $+ [ $sockname ] ] %data
    else if (<team_tag>*</team_tag> iswm %temp) set %steamid.team_tag. [ $+ [ $sockname ] ] %data
    else if (<team_irc>*</team_irc> iswm %temp) set %steamid.team_irc. [ $+ [ $sockname ] ] %data
    else if (<team_website>*</team_website> iswm %temp) set %steamid.team_website. [ $+ [ $sockname ] ] %data
    else if (%temp == </result> ) {
      if (%steamid.total. [ $+ [ $sockname ] ] < 5) {
        set %steamid.return. [ $+ [ $sockname ] ] 0,1[ 0· 8S0team8ID8:0 %steamid.player_steamid. [ $+ [ $sockname ] ] 8A0lias8:0 %steamid.player_alias. [ $+ [ $sockname ] ] 8T0eam8:0 %steamid.team_name. [ $+ [ $sockname ] ] 8C0hannel8:0 %steamid.team_irc. [ $+ [ $sockname ] ] 8L0eague8:0 %steamid.team_league. [ $+ [ $sockname ] ] 0· ]
        if ($left($gettok($sock($sockname).mark,2,32),1) == n) notice $right($gettok($sock($sockname).mark,2,32),-1) %steamid.return. [ $+ [ $sockname ] ]
        else msg %my.chan $skin(start) SteamID $skin(mid) $right($gettok($sock($sockname).mark,2,32),-1) %steamid.return. [ $+ [ $sockname ] ] $skin(end)
      }
    }
  }
  unset %steamid*
}

;#########################################################
;##################### Server Query ######################
;#########################################################

;/querysid <Steam Id>
alias querysid {
  .sockclose getsid | .sockopen getsid steamid.esportsea.com 80
  sockmark getsid $replace($1,:,$(%3A,0))
}
on *:sockopen:getsid:{
  sockwrite -n $sockname POST /?action=search&type=single&key=steam_id&query= $+ $sock($sockname).mark HTTP/1.1
  sockwrite -n $sockname Host: steamid.esportsea.com
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname $crlf
}
on *:sockread:getsid:{
  var %data | sockread %data | tokenize 32 %data
  if $regex($1-,<tr onmouseover="style.backgroundColor='#e2e9eb';" onmouseout="style.backgroundColor='';">) {
    hinc -m $sockname count
  }

  if $hget($sockname,count) == 1 {
    if $regex($1-,<td><a href=".*" target="_blank">(.*)<\/a><\/td>) { hadd -m $sockname alias $regml(1) | hinc $sockname count | return }
  }
  elseif $hget($sockname,count) == 2 {
    if $regex($1-,<td>(.+)<\/td>) { hadd -m $sockname name $regml(1) | hinc $sockname count | return }
  }
  elseif $hget($sockname,count) == 3 {
    if $regex($1-,<td>(\d:\d:\d.+)<\/td>) { hadd -m $sockname sid $regml(1) | hinc $sockname count }
  }
  elseif $hget($sockname,count) == 4 {
    if $regex($1-,<a href="(.*)" title=".*" target="_blank">(.*)<\/a>) {
      hadd -m $sockname devision $regml(2) - $regml(1)
      hinc $sockname count | return
    }
  }
  elseif $hget($sockname,count) == 5 {
    if $regex($1-,<td>(.+)<\/td>) {
      hadd -m $sockname location $regml(1)
      hinc $sockname count | return
    }
  }
  elseif $hget($sockname,count) == 6 {
    if $regex($1-,<td><a href="(.*)" target="_blank">(.*)<\/a><\/td>) {
      hadd -m $sockname team $regml(2) - $regml(1)
      hinc $sockname count | return
    }
  }
  elseif $hget($sockname,count) == 7 {
    if $regex($1-,<td>(.+)<\/td>) {
      hadd -m $sockname tag $regml(1)
      hinc $sockname count | return
    }
  }
}
on *:sockclose:getsid:{  
  if ($hget($sockname,alias)) { 
    echo -a Alias: $v1
    set %steam.alias $v1
  }
  if ($hget($sockname,name)) { 
    echo -a Name: $v1
    set %steam.name $v1
  }
  if ($hget($sockname,sid)) { 
    echo -a Steam ID: $v1
    set %steam.id $v1
  }
  if ($hget($sockname,devision)) {
    echo -a Devision: $v1
    set %steam.div $v1
  }
  if ($hget($sockname,location)) {
    echo -a Location: $v1
    set %steam.loc $v1
  }
  if ($hget($sockname,team)) {
    echo -a Team Name: $v1
    set %steam.team $v1
  }
  if ($hget($sockname,tag)) {
    echo -a Tag: $v1
    set %steam.tag $v1
  }
  msg %my.chan $skin(start) Alias:15 %steam.alias $skin(mid) Name:15 %steam.name $skin(mid) SteamID:15 %steam.id $skin(mid) Devision:15 %steam.div $skin(end)
  msg %my.chan $skin(start) Location:15 %steam.loc $skin(mid) Team:15 %steam.team $skin(mid) Tag:15 %steam.tag $skin(end)
  .hfree -sw $sockname
}


;#########################################################
;################# Counter-Strike Query ##################
;#########################################################

alias csquery {
  ; by bobby - bobby921@gmail.com - #script on irc.gamesurge.net
  ; #############################
  ; edited by Snp #snp in irc.gamesurge.net
  ; fixed source bugs, added CSProMod support
  ; fixed 1.6 dedicated/listen bug
  ; #############################
  ; function: queries a half-life server for its information using the new protocol (as of 7/25/05)
  ; usage: /queryhlserver <ip>[:port]  - (port is automatically 27015 unless otherwise specified)
  ; example: /queryhlserver 255.255.255.255
  ;          /queryhlserver 255.255.255.255:27016
  if (*.*.*.* !iswm $1) return $null
  else {
    if (($gettok($1,1,46) !isnum) || ($gettok($1,2,46) !isnum) || ($gettok($1,3,46) !isnum) || ($gettok($gettok($1,4,46),1,58) !isnum)) return $null
    else {
      if ($chr(58) isin $1) {
        var %queryhl.ip = $replace($1,$chr(58),$chr(32))
        if (($gettok(%queryhl.ip,2,32) !isnum) || ($gettok(%queryhl.ip,2,32) > 65535)) return $null
      }
      else {
        if ($2) {
          if ($2 <= 65535) var %queryhl.ip = $1 $2
          else return $null
        }
        else var %queryhl.ip = $1 27015
      }
      set %queryhl.beginticks $ticks
      .timerqueryhltimeout -o 1 2 queryhltimeout
      if ($sock(queryhlserver)) sockclose queryhlserver
      sockudp -k queryhlserver %queryhl.ip $str($chr(255),4) $+ TSource Engine Query
      sockmark queryhlserver %queryhl.ip
    }
  }
}

alias queryhltimeout {
  unset %queryhl.beginticks
  echo -a HL server timed out. Your connection or the server may be experiencing problems.
  sockclose queryhlserver
}

on *:udpread:queryhlserver:{
  var %queryhl.ping = $calc($ticks - %queryhl.beginticks)
  sockread &query
  ;; uncomment the line below if you want to see the raw return
  ;echo -a $bvar(&query,1,$bvar(&query,0))
  breplace &query 0 254 32 160
  var %queryhl.return = $bvar(&query,1,$bvar(&query,0)).text, %x = 1
  ;; uncomment the line below if you want to see the somewhat parsed return
  ;echo -a parsed return: %queryhl.return

  if (*Source* iswm $gettok(%queryhl.return,4,254)) || (*CSPromod* iswm $gettok(%queryhl.return,4,254)) || (*Fortress* iswm $gettok(%queryhl.return,4,254)) || (*DOD:S* iswm $gettok(%queryhl.return,4,254)) {
    set %source 1
    var %queryhl.hostname = $right($gettok(%queryhl.return,1,254),-6)
    var %queryhl.map = $gettok(%queryhl.return,2,254)
    var %queryhl.gamedir = $gettok(%queryhl.return,4,254)
    var %queryhl.mod = $ifmatch

  }
  else {
    ;; grab hostname, map, gamedir, and mod
    var %queryhl.hostname = $gettok(%queryhl.return,2,254)
    var %queryhl.map = $gettok(%queryhl.return,3,254)
    var %queryhl.gamedir = $gettok(%queryhl.return,4,254)
    if (%queryhl.gamedir == cstrike) { set %queryhl.gamedir Counter-Strike 1.6 }
    if (%queryhl.gamedir == ns) { set %queryhl.gamedir Natural Selection }
    var %queryhl.mod = $gettok(%queryhl.return,5,254)
  }

  ;; for position calc (prevents messed up position if mod name is in hostname)
  var %position = $regex(position,%queryhl.hostname,/ $+ %queryhl.mode $+ */g)
  if (!%position) var %position = 1
  var %positionnumber = $pos(%queryhl.return,$gettok(%queryhl.return,5,254),%position)

  ;; parsing for players
  var %gamechars = $len($gettok(%queryhl.return,5,254))
  var %charcalc = $calc(%positionnumber + %gamechars)
  var %players = $mid(%queryhl.return,%charcalc,3)

  ;; grab current connected players and maxplayers
  var %queryhl.players = $iif($asc($mid(%players,2,1)) == 254,0,$ifmatch)
  var %queryhl.maxplayers = $asc($right(%players,1))
  if (%queryhl.maxplayers == 160) var %queryhl.maxplayers = 32

  ;; parse next part and grab protocol number and server type (if players is 0 position it 1 back)
  var %2ndstring = $gettok(%queryhl.return,6,254)
  var %queryhl.protocolnumber = $asc($mid(%2ndstring,$iif(%queryhl.players == 0,2,3),1))
  if (!%queryhl.protocolnumber) var %queryhl.protocolnumber = 0
  var %queryhl.servertype = $iif($mid(%2ndstring,$iif(%queryhl.players == 0,3,4),1) == d,Dedicated,Listen)

  ;; calculate the current position in the return + 1 (where the password yes/no is)
  var %pwPos = $calc(%charcalc + $pos(%2ndstring,5,1) + 1)

  ;; grab the server operating system (if players is 0 position it 1 back), password 0|1, secure 0|1, and number of bots
  var %queryhl.serveros = $iif($mid(%2ndstring,$iif(%queryhl.players == 0,4,5),1) == l,Linux,Windows)
  if (%source == 1) {
    var %sourcestring = $gettok(%queryhl.return,-2,254)
    set %lewl $gettok(%queryhl.return,-2,254)
    var %queryhl.servertype = $iif($mid(%sourcestring,-2,1) == d,Dedicated,Listen)
    var %queryhl.serveros = $iif($right(%sourcestring,1) == l,Linux,Windows)
    unset %source
  }
  var %queryhl.password = $iif($right($mid(%queryhl.return,%pwPos,6),1) == $chr(254),No,Yes)
  var %queryhl.secure = $iif($mid($calc($len(%queryhl.return) - 1),1) == $chr(254),No,Yes)
  var %queryhl.bots = $iif($asc($right(%queryhl.return,1)) == 254,0,$ifmatch)

  ; echo results
  var %queryhl.ip = $sock($sockname).mark
  tokenize 32 %queryhl.ip
  echo -a IP Address: $+($1,:,$2) (approximate ping: %queryhl.ping $+ ms)
  echo -a Hostname: %queryhl.hostname
  echo -a Map: %queryhl.map
  echo -a Gamedir: %queryhl.gamedir
  echo -a Mod: %queryhl.mod
  echo -a Players: %queryhl.players
  echo -a Maxplayers: %queryhl.maxplayers
  echo -a Protocol Number: %queryhl.protocolnumber
  echo -a Server Type: %queryhl.servertype
  echo -a Operating System: %queryhl.serveros
  echo -a Password Protected: %queryhl.password
  echo -a VAC Secure: %queryhl.secure
  echo -a Bots: %queryhl.bots
  msg %my.chan $skin(start) Hostname:15 %queryhl.hostname $skin(mid) Game Type:15 %queryhl.gamedir $skin(mid) Listen/Dedicated:15 %queryhl.servertype $skin(end)
  msg %my.chan $skin(start) OS:15 %queryhl.serveros $skin(mid) Map:15 %queryhl.map $skin(mid) Players:15 %queryhl.players $+ / $+ %queryhl.maxplayers $skin(mid) PW:15 %queryhl.password $skin(mid) VAC:15 %queryhl.secure $skin(mid) Bots:15 %queryhl.bots $skin(end)

  unset %queryhl.beginticks
  sockclose queryhlserver
  .timerqueryhltimeout off
}



;#########################################################
;######################### Skin ##########################
;#########################################################


alias skin {
  if ($1 == start) { return 13,1(0(14 }
  if ($1 == end) { return 0)13) }
  if ($1 == mid) { return 0)13)6~13(0(14 }
}
;#########################################################
;################### Shoutcast Query #####################
;#########################################################

;/scast <ip:port> <Field> [MsgTarget]
;Fields: all, listeners, status, peak, maxlisteners, uniquelisteners, bitrate, song.
alias scast {
  if ($0 < 2) || (#* iswm $2) echo -a Invalid syntax, use the command like this: /scast <ip:port> <Field> [MsgTarget]
  else {
    var %sockname = scast- $+ $ticks
    sockopen %sockname $replace($1,:,$chr(32))
    sockmark %sockname $1

    hadd -m %sockname field $$2
    hadd -m %sockname target $$3
  }
}
on *:sockopen:scast-*: {
  if ($sockerr) {
    echo -a Failled to connect to server.
    .hfree -sw $sockname
    halt
  }
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; DigExt)
  sockwrite -n $sockname Host: $sock($sockname).mark
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname $crlf
}
on *:sockread:scast-*: {
  sockread -fn &bin
  if ($regex($bvar(&bin,1,400).text,<body>(.*)<\/body>)) {
    tokenize 44 $regml(1)
    hadd -m $sockname listeners $1
    hadd -m $sockname status $iif($2 == 1,Online,Offline)
    hadd -m $sockname peak $3
    hadd -m $sockname maxlisteners $4
    hadd -m $sockname uniquelisteners $5
    hadd -m $sockname bitrate $+($6,KB/s)
    hadd -m $sockname song $7-
  }
}
on *:sockclose:scast-*:{
  if ($hget($sockname,target)) {
    var %targ = $v1, %field1 = $hget($sockname,field)
    if (%field1 == ALL) msg %targ [^B]Status:[^B] $hget($sockname,status) [^B]Song:[^B] $hget($sockname,song) [^B]Listeners:[^B] $hget($sockname,listeners) [^B]Peak Listeners:[^B] $hget($sockname,peak)
    elseif ($hget($sockname,%field1)) {
      var %field2 = $v1
      msg %targ $+([^B],%field1,[^B]) $+ : $hget($sockname,%field1)
    }
  }
  else {
    if ($hget($sockname,field)) {
      var %field = $v1
      if (%field == all) echo -a [^B]Status:[^B] $hget($sockname,status) [^B]Song:[^B] $hget($sockname,song) [^B]Listeners:[^B] $hget($sockname,listeners) [^B]Peak Listeners:[^B] $hget($sockname,peak)
      elseif ($hget($sockname,%field)) echo -a %field $+ : $v1
    }
    else {
      echo -a [^B]Status:[^B] $hget($sockname,status)
      echo -a [^B]Song:[^B] $iif($hget($sockname,song),$v1,None)
      echo -a [^B]Peak:[^B] $hget($sockname,peak)
      echo -a [^B]Listeners:[^B] $hget($sockname,listeners)
      echo -a [^B]Max Listeners:[^B] $hget($sockname,maxlisteners)
      echo -a [^B]Bitrate:[^B] $hget($sockname,bitrate)
    }
  }
  .hfree -sw $sockname
}
;##################
alias c {
  if (!$isid) {
    var %r = 1
    while (%r <= $len($1-)) {
      var %q = %q $+ $iif($mid($1-,$calc(%r - 1),1) == $chr(32),$chr(32),) $+ $iif($calc(%r % 2) == 0,04,03) $+ $mid($1-,%r,1)
      inc %r
    }
    say  $+ %q
  }
  else {
    %x = 1
    while (%x <= $0) {
      var %r = 1
      while (%r <= $len($eval($+($chr(36),%x),2))) {
        var %q = %q $+ $iif(%r == 1,$chr(32),$iif($mid($eval($+($chr(36),%x),2),$calc(%r - 1),1) == $chr(32),$chr(32),)) $+ $iif($calc(%r % 2) == 0,04,03) $+ $mid($eval($+($chr(36),%x),2),%r,1)
        inc %r
      }
      var %q = %q $+ $iif($mid($($+($chr(36),%x)),$calc(%r - 1),1) == $chr(32),$chr(32),) $+ $iif($calc(%r % 2) == 0,04,03) $+ $chr(44)
      inc %x
    }
    return  $+ $right($left(%q,-1),-1)
  }
}
;####################
alias carebot {
  var %x 1
  while (%x <= 20) {
    set %cbar.bars %cbar.bars $+ $chr(124) $+ $chr(44)
    inc %x
  }
  var %cbar.tok $rand(1,20)
  var %cbar.temp = $chr(2) $+ %cbar.bars
  var %cbar.rep = $reptok(%cbar.temp,$chr(124),$chr(124) $+ $chr(2),%cbar.tok,44)
  var %i 1
  while (%i <= $numtok(%cbar.rep,44)) {
    set %cbar.return %cbar.return $+ $gettok(%cbar.rep,%i,44)
    inc %i
  }
  msg %my.chan $skin(start) Care-o-Metre $skin(mid) Care-Factor:6 $chr(91) $+ 15 $+ %cbar.return $+ 6 $+ $chr(93) 15= $calc(%cbar.tok / 20 *100) $+ % $skin(end)
  unset %cbar.*
}


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