Code: Select all
utimer $unlockin [list reset [string tolower $chan]]
Code: Select all
utimer $insec [list reset [string tolower $chan]]
Code: Select all
utimer $unlockin [list reset [string tolower $chan]]
Code: Select all
utimer $insec [list reset [string tolower $chan]]
but the problem is the bot dont do unlock the channel after lock it... do u know where s the problem# njf.tcl
# version 0.3
# caesar <cezarica@prietenii.com>
# #eggdrop @ Undernet.org
# http://www.geocities.com/caesartcl/
### Description:
# An small and efective channel locker in case of an botnet join.
#
### What's new?
# o added specific channel flag, this means it will work only for channels that have +njf flag;
# o corrected some problems regarding the channel locker (thanks to ppslim for the solution
# and to Gothic-Angel for pointing this out!);
# o some other small fixes.
#
### Many thanks to:
# o MassKilla (#eggdrop @ Undernet) for the help on arrays and stuff;
# o ppslim for the solution on the channel locker modes;
# o Gothic-Angel for tryng and pointing out some problems in the previous version.
#
#
### Instructions:
# In order it to work on your channel, it must have +njf flag. Use .chanset to add/remove it.
#
### Commands:
#
# Where Flag Command Description
# ----- ---- ------- -----------
#
# PUB : N/A
#
# MSG : N/A
#
# DCC : n|n .chanset Use .chanset to set the script active for the particular channel or not.
# Example: .chanset #bla +njf
# .chanset #bla -njf
#
### Settings:
#
# What channel modes do you want to be used for locking the channel?
set modes "mR"
# Number of joins in seconds keep channel locked for?
# By default I've set it to 8 joins in 3 seconds to lock the channel for 60 seconds.
set jtu 6:4:30
### ANY EDITING AND/OR MODIFICATIONS MADE BEYOND THIS IS YOUR OWN RISK! ###
# stuff
setudef flag njf
foreach chan [channels] {
if {![channel get [string tolower $chan] njf]} { continue }
set val([string tolower $chan]) 0 }
# binds
bind join - * njf:join
bind part - * njf:part
# join
proc njf:join {nick uhost handle chan} {
global val
if {$nick == $::botnick || ![botisop [string tolower $chan]] || ![channel get [string tolower $chan] njf]} {
return
}
# fix after an .chanset on a channel
if {![info exists val([string tolower $chan])]} { set val([string tolower $chan]) 0 }
# is channel locked?
set cm [getchanmode $chan]
if {(([string match {+*[$::modes]*[::modes]*} $cm]) && ([llength [split $::modes]] == 1)) || (([string match {+*[::modes]*[::modes]* *} $cm]) && ([length [split $cm]] > 1))} { return }
# array fix
foreach channel [array names val] {
if {[string match [string tolower $chan] [string tolower $chan]nel]} {
array set val "[string tolower $chan] 0"
}
}
# continue
set nojoins [lindex [split $::jtu ":"] 0]
set insec [lindex [split $::jtu ":"] 1]
set unlockin [lindex [split $::jtu ":"] 2]
incr val([string tolower $chan])
utimer $insec [list reset [string tolower $chan]]
if {$val([string tolower $chan]) >= $nojoins} {
putquick "MODE [string tolower $chan] +$::modes"
utimer $insec [list reset [string tolower $chan]]
}
}
# reset
proc reset {chan} {
global val
incr val([string tolower $chan]) -1
return
}
# unlock
proc unlock {chan} {
putquick "MODE [string tolower $chan] -$::modes"
return
}
# array remove
proc njf:part { nick uhost hand chan msg } {
global val
if {$nick != $::botnick} {
return
}
foreach arr_part [array names val] {
if {[string match [string tolower [string tolower $chan]] $arr_part]} {
array unset val [string tolower $chan]
}
}
}
putlog "njf.tcl loaded.."
Code: Select all
### Settings:
# What channel modes do you want to be used for locking the channel?
set njf(modes) "m"
# Number of joins in seconds keep channel locked for?
# By default I've set it to 8 joins in 3 seconds to lock the channel for 60 seconds.
set njf(jtu) 8:3:60
#
###
#### Done with configurations, do not edit past here unless you know TCL!
###
#
##
# stuff
setudef flag njf
##
# binds
bind join - * njf:join
bind part - * njf:part
##
# join
proc njf:join {nick uhost handle chan} {
global njvno
set chan [string tolower $chan]
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan njf]} {
return
}
if {![info exists njvno($chan)]} {
set njvno($chan) 0
}
if {[string equal [join [lsort [split $::njf(modes) ""]] ""] [join [lsort [split [string trim [getchanmode $chan] "+"] ""]] ""]]} {
return
}
set bla [split $::njf(jtu) ":"]
set nojoins [lindex $bla 0]
set insec [lindex $bla 1]
set unlockin [lindex $bla 2]
incr njvno($chan)
utimer $insec [list njf:reset $chan]
if {$njvno($chan) >= $nojoins} {
putquick "MODE $chan +$::njf(modes)" -next
utimer $unlockin [list njf:unlock $chan]
}
}
##
# reset
proc njf:reset {chan} {
global njvno
incr njvno($chan) -1
return
}
##
# unlock
proc njf:unlock {chan} {
putquick "MODE $chan -$::njf(modes)" -next
return
}
##
# array remove
proc njf:part {nick uhost hand chan msg} {
global njvno
if {![isbotnick $nick]} {
return
}
foreach arr_part [array names njvno] {
if {[string match $chan $arr_part]} {
array unset njvno $chan
}
}
}
Code: Select all
if {[string equal [join [lsort [split $::njf(modes) ""]] ""] [join [lsort [split [string trim [getchanmode $chan] "+"] ""]] ""]]} {
return
}
Code: Select all
set tmp [split [string trim [lindex [split [getchanmode $chan]] 0] "+"] ""]
if {[regexp -all [join [split $::njf(modes) ""] "|"] $tmp] == [string length $::njf(modes)]} {
return
}