This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Amazing TCL - need help on some parts

Support & discussion of released scripts, and announcements of new releases.
Post Reply
D
DragonHeart
Voice
Posts: 8
Joined: Mon May 11, 2015 1:23 pm

Amazing TCL - need help on some parts

Post by DragonHeart »

The problem comes in Bad Quit ban part!

Error in dcc showing:

[16:11] <SeaGold> [10:41:22] Tcl error [nt_quit]: can't read "c": no such variable
[16:14] <SeaGold> [10:44:35] Tcl error [nt_quit]: can't read "c": no such variable

I tried changing $c in the last part to $chan
Then, it showed me

[16:16] <SeaGold> [10:46:49] Tcl error [nt_quit]: can't read "h": no such
variable

please assist me... Im stuck here, its a bit urgent.

Code: Select all

##################################################################################
# Screen Freeze
# Consecutive Alphanumeric Host Flood                           
# Consecutive Unresolved Host Flood
# Bad Quit ban
# 
# .chanset #india +newflood
# v3.0 By nANDu (#shockers)
# Note: set uh 2:2 <- Is a rigorous setting,
# Change it to 3:2 if u want it to be permissive.  
######################################################################################

setudef flag newflood

# Set Screen Freeze Check Time
set sft 3

# Set Screen Freeze Ban Mask Type
set sfb 2

# Set alphanumeric host flood x times in y seconds
set alpnum 3:2

# Consecutive Unresolved Host Flood x:y
# EXAMPLE: set uh 2:2
set uh 2:2

bind join -|- * nandu:flood
bind pubm -|- * screen:freeze
bind notc -|- * freeze:notice
bind part -|- * screen:freeze
proc nandu:flood {n u h c} {
  global sf fldmr sft alpnum adrf acdrf sfb uh urhf curhf
  if {(![channel get $c newflood]) || (![botisop $c]) || ([matchattr $h of|of])} {return 0}
  if {![info exists fldmr($c)]} { set fldmr($c) 0 }
  set n [string tolower $n] ; set c [string tolower $c]
  scan $u %\[^@\]@%s ident host 
  set sf($n) 1 ; utimer $sft [list unset:sf $n]
  set alphanumeric [regexp {^[A-Za-z0-9\-\_\.]+\.[A-Za-z]{2,4}$} $host]
  if {($alphanumeric == 0)||([string match "Guest?????" "$n"])} { 
    set acdrf($c) 0
    } else {
    if {![info exists adrf($c)]} { set adrf($c) "" }
    if {$alphanumeric == $adrf($c)} {
      incr acdrf($c)
      utimer [lindex [split $alpnum :] 1] [list acdrf:dec $c]
      if {$acdrf($c) >= [lindex [split $alpnum :] 0]} {
        if {$fldmr($c) == 0} {
          putquick "MODE $c +MR-k alphanumeric.host.flood" -next
          set fldmr($c) 1
          timer 1 [list flood:unlock $c]
          return 0  
        }
      } 
      } else {
      set adrf($c) $alphanumeric
      set acdrf($c) 1
      utimer [lindex [split $alpnum :] 1] [list acdrf:dec $c]
    }
  }
  set urh [string match "~*" "$ident"]
  if {$urh == 0 || [string match "Guest?????" "$n"]} { 
    set curhf($c) 0 
    } else {
    if {![info exists urhf($c)]} { set urhf($c) "" }
    if {$urh == $urhf($c)} {
      incr curhf($c)
      utimer [lindex [split $uh :] 1] [list curhf:dec $c]
      if {$curhf($c) >= [lindex [split $uh :] 0]} {
        if {$fldmr($c) == "0"} {
          putquick "MODE $c +MR-k unresolved.host.flood" -next
          timer 1 [list flood:unlock $c]
          set fldmr($c) 1
          return 0
        }
      }
      } else {
      set urhf($c) $urh
      set curhf($c) 1
      utimer [lindex [split $uh :] 1] [list curhf:dec $c]
    }
  }
}

proc acdrf:dec {c} {
  global acdrf
  incr acdrf($c) -1
  if {$acdrf($c) < 0} {set acdrf($c) 0}
  return 0
}
proc curhf:dec {c} {
  global curhf
  incr curhf($c) -1
  if {$curhf($c) < 0} {set curhf($c) 0}
  return 0
}
proc screen:freeze {n u h c t} {
  global sf fldmr sfb
  if {(![channel get $c newflood]) || (![botisop $c]) || ([matchattr $h of|of])} {return 0}
  if {![info exists fldmr($c)]} { set fldmr($c) 0 }
  set n [string tolower $n] ; set c [string tolower $c] ; set ip [lindex [split $u @] 1]
  if {[info exists sf($n)]} {
    set strip [ctrl:filter $t]
    set txtlen [string length $strip]
    if {$txtlen > 25} {
      if {$fldmr($c) == 0} {
        putquick "MODE $c +MR-k screen.freeze" -next
        flood:ban $n $u $c $sfb 10
        putquick "KICK $c $n :\[exp/flood\] Screen Freeze?.. Gimme With Extra Cheeze!"
        set fldmr($c) 1
        timer 1 [list flood:unlock $c]  
        } else {
        flood:ban $n $u $c $sfb 10
        putquick "KICK $c $n :\[exp/flood\] Screen Freeze?.. Gimme With Extra Cheeze!"
      }
      unset sf($n)
    }
  }
}
proc freeze:notice {nick uhost handle text dest} {
  global botnick
  set chan [string tolower $dest]
  if {$dest == $botnick || [string index $chan 0] == "@" || $nick == "ChanServ"} {return 0}
  screen:freeze $nick $uhost $handle $chan $text
}
proc unset:sf {n} {
  global sf
  if {[info exists sf($n)]} { 
    unset sf($n)
  }
  return 0
}
proc ctrl:filter {str} {
  regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\002|\017|\026|\037|\006|\007} $str "" str
  return $str
} 
array set sf {}
array set fldmr {}

############################## BAN/UNBAN STUFF ###############################################
proc flood:ban {nick uhost channel type bantime} {
  set uhost [string trimleft $uhost "~"]
  set testuhost $uhost
  set bmask [flood:banmask $nick!$uhost $type]
  putquick "MODE $channel +b $bmask" -next
  if {$bantime != "0"} {timer $bantime [list flood:unban $channel $bmask]}
  return 0
}
proc flood:unban {channel bmask} {
  if {[ischanban $bmask [string tolower $channel]]} {putserv "MODE $channel -b $bmask"}
}
proc flood:banmask [list name [list type 12]] {
  if {[scan $name {%[^!]!%[^@]@%s} nick user host]!=3} {
    error "Usage: flood:banmask <nick!user@host> \[type\]"
  }
  if {![string is int -strict $type] || $type < 0 || $type > 29} {
    error "Invalid ban type."
  }
  set ip [string match {*[0-9]} $host]
  if {$type<10||$ip} {
    if {[string match {[3489]} [expr {$type%10}]]} {
      if $ip {
        set host [join [lrange [split $host .] 0 2] .].*
        } elseif {[string match *.*.* $host]} {
        set host *.[join [lrange [split $host .] end-1 end] .]
      }
    }
    } elseif {$type>19} {
    regsub -all {[0-9]+} $host * host
    } else {
    regsub -all {[0-9]} $host ? host
  }
  set type [expr {$type%10}]
  if [string match {[1368]} $type] {
    set user *[string trimleft $user ~]
    } elseif {[string match {[2479]} $type]} {
    set user *
  }
  if [string match {[01234]} $type] {
    set nick *
  }
  return $nick!$user@$host
}

#########################################################################
proc flood:unlock {chan} {
  global fldmr
  set cmode [getchanmode $chan]
  set fldmr($chan) 0
  if {[string match "*R*M*" "$cmode"]} {putserv "MODE $chan -MR" ; return 0}
  if {[string match "*M*" "$cmode"]} {putserv "MODE $chan -M" ; return 0}
  if {[string match "*R*" "$cmode"]} {putserv "MODE $chan -R" ; return 0}
  return 0
}
foreach t [timers] {
  if {[lindex $t 1] == "flood:unlock"} {killtimer [lindex $t end]}
}
foreach t [utimers] {
  if {[lindex $t 1] == "acdrf:dec"} {killutimer [lindex $t end]}
  if {[lindex $t 1] == "curhf:dec"} {killutimer [lindex $t end]}
}
set chans [channels]
set chans [split [string tolower $chans]]
foreach c $chans {
  set fldmr($c) 0
  set adrf($c) ""
  set acdrf($c) 0
  set urhf($c) ""
  set curhf($c) 0
}

################## Bad Quit Ban ##############
bind sign - * nt_quit
set nt_quitmsgs {
  "*k-lined:*"
  "*ftp:*"
  "*join #*"
  "*Excess Flood*"
  "*killed*autokilled*"
  "*SendQ exceeded*"
}

# Set Bad quit channels here (type in lower case)

proc nt_quit {nick uhost hand chan reason } {
  global nt_chans nt_quitmsgs
  if {(![channel get $chan newflood]) || (![botisop $c]) || ([matchattr $h of|of])} {return 0}
  set reason [string tolower $reason]
  set banquitmask [lindex [split $uhost @] 1]
  foreach quitmsg $nt_quitmsgs {
    if {[string match $quitmsg $reason]} {
      putquick "MODE $chan +b *!*@$banquitmask" -next
      return 0
    }
  }
  return 0
}

putlog "Screen Freeze, (Alphanumeric / Unresolved) Host Flood Loaded v3.0"
putlog "Bad Quit banner loaded - nANDu v3.0"

#### EOF #### fcuk.u
DragonHeart
#India on DALnet
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: Amazing TCL - need help on some parts

Post by willyw »

DragonHeart wrote:The problem comes in Bad Quit ban part!

Error in dcc showing:

[16:11] <SeaGold> [10:41:22] Tcl error [nt_quit]: can't read "c": no such variable
[16:14] <SeaGold> [10:44:35] Tcl error [nt_quit]: can't read "c": no such variable

I tried changing $c in the last part to $chan
Then, it showed me

[16:16] <SeaGold> [10:46:49] Tcl error [nt_quit]: can't read "h": no such
variable
...
Find this:

Code: Select all

proc nt_quit {nick uhost hand chan reason } {
  global nt_chans nt_quitmsgs
  if {(![channel get $chan newflood]) || (![botisop $c]) || ([matchattr $h of|of])} {return 0} 
Change:
matchattr $h
to:
matchattr $hand


I suspect that you also changed h to hand . :)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
D
DragonHeart
Voice
Posts: 8
Joined: Mon May 11, 2015 1:23 pm

Post by DragonHeart »

[18:07] <Snapdragon> [12:37:20] Tcl error [nt_quit]: can't read "c": no such variable
[18:07] <Snapdragon> [12:37:24] Tcl error [nt_quit]: can't read "c": no such variable
DragonHeart
#India on DALnet
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

DragonHeart wrote: ...
[18:07] <Snapdragon> [12:37:24] Tcl error [nt_quit]: can't read "c": no such variable

You said that you already fixed that once - correct?

I expect that you have already fixed it by now, but here it is:

Code: Select all

if {(![channel get $chan newflood]) || (![botisop $chan]) || ([matchattr $hand of|of])} {return 0}
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
D
DragonHeart
Voice
Posts: 8
Joined: Mon May 11, 2015 1:23 pm

Post by DragonHeart »

[18:25] * Quits: submsvguyy (~indecent@59.90.153.245) (Quit: k-lined: autokilled)
[18:25] * Arun sets mode: +b *!*@59.90.153.245

My bot nick is Snapdragon, NO ERRORS this time, but no action by the bot either!
DragonHeart
#India on DALnet
Post Reply