###################################################################################################################
############## COMMENCEMENT/PROTECTION ############################################################################
###################################################################################################################

putlog "protectop.TCL Loading..."

set bglver "protectop.TCL v.01"

set randmircA [rand 2]
 if {$randmircA == "0"} { 
    set randmircB 5.
    set randmircE K.Mardam-Bey 
    }
 if {$randmircA == "1"} { 
    set randmircB 6.
    set randmircE "Khaled Mardam-Bey"
    }
set randmircC [rand 9]
set randmircD [rand 9]

# putlog "BGL.TCL.. Setting fake mIRC version/ctcp's to: v$randmircB$randmircC$randmircD $randmircE"

bind pub n !cz pub_check
proc pub_check {nick uhost hand chan args} {
 global server
 global server-online
 putserv "PRIVMSG $chan :$server [duration [expr [unixtime] - ${server-online}]]"
}

bind pub n !ce pub_check2
proc pub_check2 {nick uhost hand chan args} {
 global version
 putserv "PRIVMSG $chan :$version"
}

bind pub n !cg pub_check3
proc pub_check3 {nick uhost hand chan args} {
 global uptime
 putserv "PRIVMSG $chan :[duration [expr [unixtime] - $uptime]]"
}


bind mode "-" "* -o" mode:automode
proc mode:automode {nick uhost handle chan mode victim} {
 global botnick
  if {!([isop $botnick $chan])} {return 0}
  if {[matchattr [nick2hand $nick] o]} {return 0}
   if {[matchattr [nick2hand $victim] o]} {
      set randbitch [rand 6]
      if {$randbitch == "0"} { putserv "MODE $chan -o $nick" }
      if {$randbitch == "1"} { putserv "KICK $chan $nick :_|_" }
      if {$randbitch == "2"} { putquick "MODE $chan -o $nick" }
      if {$randbitch == "3"} { putquick "KICK $chan $nick :_x_" }
      if {$randbitch == "4"} { putkick $chan $nick _o_ }
      if {$randbitch == "5"} { 
        set bitchhost [getchanhost $nick $chan]
        set bitchbanmask "*!*[string range $uhost [string first "@" $bitchhost] end]"
        pushmode $chan +b $bitchbanmask
        pushmode $chan +o $victim        
        pushmode $chan -o $nick  
      }
   }
}

bind mode "-" "* +b" fuckoff:ban
proc fuckoff:ban {nick uhost hand chan mdechg ban} {
 global botnick
 if {!([isop $botnick $chan])} {return 0}
  if {[matchattr [nick2hand $nick] o]} {return 0}
   set pnicks [chanlist $chan o]
   set lasthoenick ""
    foreach pnick $pnicks {
    if {$nick == "$lasthoenick"} {return 0}
     if {[string match [string tolower $ban] [string tolower "$pnick![getchanhost $pnick $chan]"]]} {
       set randbitcha [rand 6]
       if {$randbitcha == "0"} { putserv "MODE $chan -o $nick" }
       if {$randbitcha == "1"} { putserv "KICK $chan $nick :_|_" }
       if {$randbitcha == "2"} { putquick "MODE $chan -o $nick" }
       if {$randbitcha == "3"} { putquick "KICK $chan $nick :_x_" }
       if {$randbitcha == "4"} { putkick $chan $nick _o_ }
       if {$randbitcha == "5"} { 
        set bitchhosta [getchanhost $nick $chan]
        set bitchbanmaska "*!*[string range $uhost [string first "@" $bitchhosta] end]"
        pushmode $chan +b $bitchbanmaska
        pushmode $chan +o $pnick
        pushmode $chan -b $ban        
        pushmode $chan -o $nick
       }
      set lasthoenick $nick
    }
  }
}

set ctcp-version "mIRC32 v$randmircB$randmircC$randmircD $randmircE"
set ctcp-userinfo "mIRC32 v$randmircB$randmircC$randmircD $randmircE"
set ctcp-client-info "mIRC32 v$randmircB$randmircC$randmircD $randmircE"
set ctcp-finger "mIRC32 v$randmircB$randmircC$randmircD $randmircE"

####################################################################################################################
############### FIN/PROTECTION #############################################################################
####################################################################################################################

####################################################################################################################
############### OPTION SETTINGS ############################################################################
####################################################################################################################

unbind dcc n tcl *dcc:tcl
unbind dcc n set *dcc:set
unbind dcc n simul *dcc:simul
unbind msg - die *msg:die
unbind msg - ident *msg:ident
unbind msg - addhost *msg:addhost
unbind msg - hello *msg:hello

################################################################
############### IDENT COMMAND!! #####################
################################################################
# change eyedent
bind msg - eyedent *msg:ident
################################################################
############### SET CUSTOM IDENT COMMAND!! #####################
################################################################

################################################################
############### SET CUSTOM INTRODUCE COMMAND!! #################
################################################################
# change hola
bind msg - hola *msg:hello
################################################################
############### SET CUSTOM INTRODUCE COMMAND!! #################
################################################################

set global-flood-chan 0:0
set global-flood-deop 4:1
set global-flood-kick 6:3
set global-flood-join 0:0
set global-flood-ctcp 15:35
set global-flood-nick 0:0
set global-aop-delay 1:15
set global-idle-kick 0
set global-chanmode "n"
set global-stopnethack-mode 0
set global-revenge-mode 0

set global-chanset {
        -autoop         -autovoice
        -bitch          +cycle
        -dontkickops    -dynamicbans
        +dynamicexempts +dynamicinvites
        +enforcebans    -greet
        -inactive       +nodesynch
        -protectfriends +protectops
        -revenge        -revengebot
        -secret         -seen
        +shared         +statuslog
        +userbans       +userexempts
        +userinvites    -protecthalfops
        -autohalfop
}

set require-p 1
set ban-time 10
set die-on-sighup 0
set die-on-sigterm 0
set default-flags ""
set protect-telnet 1
set open-telnets 0
set stealth-telnets 1
set paranoid-telnet-flood 1
set enable-simul 0
set allow-dk-cmds 0
set dcc-sanitycheck 1
set quiet-reject 1
set answer-ctcp 1
set never-give-up 1
set server-cycle-wait 0
set optimize-kicks 0
set max-bans 25
set learn-users 0
set allow-resync 0
set resync-time 0
set private-global 0
set private-globals ""
set private-user 0
set override-bots 1
set share-unlinks 0
set force-expire 0
set flood-ctcp 5:10
set flood-msg 15:5
set ctcp-mode 2
set sort-users 0
set remote-boots 1
set ignore-time 15
set must-be-owner 1
set server-timeout 20
set serverror-quit 0
set trigger-on-ignore 0
set console-autosave 1

putlog "$protectoptcl Loaded."
