All pastes #330836 Raw Edit

Anonymous

public text v1 · immutable
#330836 ·published 2007-01-28 09:57 UTC
rendered paste body
#cmbreq off

on !*:join:#pest_control:{
  if ($readini(pc_e.ini,$chan,$nick) == yes) { halt }  
  if (!%r.id) { set -u60 %r.id  1 }
  else { inc %r.id }
  set $+(%,s.nick,%r.id) $nick
  sockopen $+(cmb,.,%r.id) useless-site.com 80
}

alias -l c.num {
  return $remove($sockname,cmb.)
}

on *:sockopen:cmb.*:{
  sockwrite -nt $sockname GET /parsers/stats.php?mode=cmb&user= $+ $eval($+(%,s.nick,$c.num),2) HTTP/1.1
  sockwrite -nt $sockname Host: useless-site.com $+ $crlf
  sockwrite -nt $sockname Connection: Close
  sockwrite -t $sockname $crlf
}

on *:sockread:cmb.*:{
  var %read
  sockread %read
  if (Combat isin %read) { set $+(%,cmb,$c.num) %read }
}

on *:sockclose:cmb.*:{
  if ($eval($+(%,cmb,$c.num),2) == 0) { ban -ku60 $chan $nick 2 Combat was found to be zero, please either get an exception for your nick or switch to your RSN }
  if ($eval($+(%,cmb,$c.num),2) < %cmb.req) { ban -ku600 $chan $nick 2 Combat was found to be less than the requirements, please train more, and then come visit us again }
}


#cmbreq end

on $*:text:/^[.!@](cmb)?req\s(on|off)?$/Si:#pest_control:{
  set.tar $1
  if (!$2) { %send 14Syntax is:07 !cmbreq on/off 14Low Level Kick is currently:07 %llk }
  if ($2 == on) { enable #cmbreq | %send Combat Requirements are now on | set %llk on }
  if ($2 == off) { disable #cmbreq | %send Combat Requirements are now off | set %llk off }
  un.tar
}

on $*:text:/^[.!@](add|del)except(ion)?\s/Si:#pest_control:{
  set.tar $1
  if ($regml(1) == add) {
    writeini pc_e.ini $chan $2 yes
    %send 07 $+ $2 14has been added to the exception list in 07 $+ $chan
  }
  if ($regml(1) == del) {
    remini pc_e.ini $chan $2
    %send 07 $+ $2 14has been deleted from the exception list in 07 $+ $chan
  }
  un.tar
}

alias -l set.tar {
  if ($left($1,1) == @) { set %send msg $chan }
  else { set %send notice $nick }
}

alias -l un.tar { unset %send }

dialog cmbreq {
  title "Combat Requirements"
  size -1 -1 220 -1
  option pixels

  text "--- #Pest_Control Combat Requirements ---",1,5 5 215 25 
  edit %cmbreq ,2,5 40 50 20
  text "Minimum Combat Level",3,60 42 150 20
  button "Enable",4,45 90 60 20
  button "Disable",5,110 90 60 20
  text "--Low Level Kick--",6,5 70 210 20, center
  text "Currently: ",7,5 110 210 15, center
  text %llk ,8,5 125 210 15, center
  button "Ok",9,90 160 60 30, ok
  button "Cancel",10,155 160 60 30
}

on *:dialog:cmbreq:sclick:*:{
  if ($did == 4) { .enable #cmbreq | echo -a Combat Requirements are now on | set %llk on | did -ro $dname 8 1 on }
  if ($did == 5) { .disable #cmbreq | echo -a Combat Requirements are now off | set %llk off | did -ro $dname 8 1 off  }
  if ($did == 9) { set %cmbreq $did(2).text }
  if ($did == 10) { dialog -x cmbreq }
}

alias cmbreq { dialog -mh cmbreq cmbreq }

menu chanlist,status { Combat Reqs:/cmbreq }

menu nicklist { 
  PC.CR Exceptions
  .Add Exception:{ writeini pc_e.ini $active $1 yes | echo -a $1 has been added to the Low Level Kick Exception list }
  .Del Exception:{ remini pc_e.ini $active $1 yes | echo -a $1 has been deleted from the Low Level Kick Exception list }
}