egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Amazing TCL - need help on some parts

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
DragonHeart
Voice


Joined: 11 May 2015
Posts: 8

PostPosted: Wed May 13, 2015 7:02 am    Post subject: Amazing TCL - need help on some parts Reply with quote

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:
##################################################################################
# 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
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed May 13, 2015 7:53 am    Post subject: Re: Amazing TCL - need help on some parts Reply with quote

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:

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 . Smile
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
DragonHeart
Voice


Joined: 11 May 2015
Posts: 8

PostPosted: Wed May 13, 2015 8:37 am    Post subject: Reply with quote

[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
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed May 13, 2015 8:43 am    Post subject: Reply with quote

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:

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 !
Back to top
View user's profile Send private message
DragonHeart
Voice


Joined: 11 May 2015
Posts: 8

PostPosted: Wed May 13, 2015 8:56 am    Post subject: Reply with quote

[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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber