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.

notice protection

Old posts that have not been replied to for several years.
Locked
D
Doom
Voice
Posts: 34
Joined: Fri Jun 20, 2003 9:33 am

notice protection

Post by Doom »

##
# "x" notices sent to channel in "y" seconds will lock the channel for "z" minutes"
set ntl 1:1:60

##
# What channel modes do you want to be used when locking the channel?
set modes "MR"

##
# How the ban reason should sound like?
set ntcbreas "No Channel Notice!! 5 min ban"

##
# For how many minutes the flooder should be banned?
set ntctime 5

#
###
#### Done with configurations, do not edit past here unless you know TCL!
###
#

# binds #
bind notc - * chan:notice
bind part - * notice:part

# stuff #
set blist ""

# array fix #
foreach dest [channels] {
set ntc([strlwr $dest]) 0
}

# notice? #
proc chan:notice {nick uhost hand text dest} {
global ntc blist
if {[lindex [split $dest "@"] 0] == $::botnick || [lindex [split $dest "@"] 1] != ""} {
return
}
set cm [getchanmode [strlwr $dest]]
if {(([string match {+*[$::modes]*[::modes]*} $cm]) && ([llength [split $::modes]] == 1)) || (([string match {+*[::modes]*[::modes]* *} $cm]) && ([length [split $cm]] > 1))} { return }

if {![info exists ntc([strlwr $dest])]} { set ntc([strlwr $dest]) 0 }

lappend blist [strlwr $nick]
set nonotc [lindex [split $::ntl ":"] 0]
set insec [lindex [split $::ntl ":"] 1]
set unlockin [lindex [split $::ntl ":"] 2]
incr ntc([strlwr $dest])
utimer $insec [list reset [strlwr $dest]]
utimer $insec [list remove [strlwr $uhost]]
if {$ntc([strlwr $dest]) >= $nonotc} {
putquick "MODE [strlwr $dest] +$::modes" -next
foreach luser $blist {
set mask "*!*@[lindex [split [getchanhost $luser [strlwr $dest]] @] 1]"
newchanban [strlwr $dest] $mask $::botnick $::ntcbreas $::ntctime
}
utimer $unlockin [list unlock [strlwr $dest]]
}
}

# reset #
proc reset {dest} {
global ntc
incr ntc([strlwr $dest]) -1
return
}

# remove #
proc remove {nick} {
global blist
set index [lsearch -exact $blist [strlwr $nick]]
set blist [lreplace $blist $index $index]
return
}

# unlock #
proc unlock {dest} {
putquick "MODE [strlwr $dest] -$::modes"
return
}

# array remove #
proc notice:part {nick uhost hand chan msg} {
global ntc
if {$nick != $::botnick} {
return
}
foreach arr_part [array names ntc] {
if {[string match [strlwr $chan] $arr_part]} {
array unset ntc [strlwr $chan]
}
}
}

-
i found this script somewhere on this forum (dont remember what topic it was) so i want to change so scripts ban user on identd@host and it dont react on Chanserv/nickserv.?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I've made it for Sir_Fz in this topic. It is designed to lock the channel on x notices in y seconds with z channel modes. Anyway, it needs some changes.. I'll start doing them and make it public or something..

As for your questions:
1. add NickServ and Chanserv as a friend to your bot, then add:

Code: Select all

if {[matchattr $hand f|f $chan]} {
return
}
before the "set cm [getchanmode [strlwr $dest]]"
2. for the banmask replace:

Code: Select all

set mask "*!*@[lindex [split [getchanhost $luser [strlwr $dest]] @] 1]" 
with:

Code: Select all

set mask [maskhost [getchanhost $luser [strlwr $dest]] 
Once the game is over, the king and the pawn go back in the same box.
D
Doom
Voice
Posts: 34
Joined: Fri Jun 20, 2003 9:33 am

Post by Doom »

i got some error in it...

Tcl error [chan:notice]: missing close-bracket?
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Post by spyda »

Quote ceasar..
set mask [maskhost [getchanhost $luser [strlwr $dest]]
chage it to..

Code: Select all

set mask [maskhost [getchanhost $luser [strlwr $dest]]]
Hope the helps.
-----------
ThePope
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oups, yes, that should do fine, forgot one ] ..
Once the game is over, the king and the pawn go back in the same box.
D
Doom
Voice
Posts: 34
Joined: Fri Jun 20, 2003 9:33 am

Post by Doom »

i got one more error :(

when someone notices the chan i get " Tcl error [chan:notice]: can't read "chan": no such variable" in the dcc party line
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Aghhh.. damn.. replace from:

Code: Select all

if {[matchattr $hand f|f $chan]} {
to:

Code: Select all

if {[matchattr $hand f|f $dest]} {
sorry.. :-?
Once the game is over, the king and the pawn go back in the same box.
D
Doom
Voice
Posts: 34
Joined: Fri Jun 20, 2003 9:33 am

Post by Doom »

can't read "val(#channel)": no such element in array
now i get this , auch :) and how to make this to not kick ops?

and
16:34:11] *** bot sets mode: -o+b Doom
[16:34:11] *** You were kicked by bot (banned:No Channel Notice!! 5 min ban)
[16:34:11] *** Attempting to rejoin...
[16:34:13] *** ChanServ (service@dal.net) invites you to join #channel
[16:34:15] *** Rejoined channel #channel
[16:34:16] *** ChanServ sets mode: +o Doom
[16:34:17] *** ChanServ sets mode: +o Doom
[16:35:32] *** Doom sets mode: +o bot
[16:35:32] *** Bot sets mode: -o+b Doom
[16:35:32] *** ChanServ sets mode: +o Doom
[16:35:33] *** You were kicked by Sandzak (banned:No Channel Notice!! 5 min ban)
[16:35:33] *** Attempting to rejoin...
how to make bot to not ban me again when he get op and dont ban Ops..?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Well why don't u download tsunami.tcl 0.3 from here and use it, it works for both notice and longline tsunami floods and it has no buggs :), just fix the mask u want it to ban. (posted earlier by caesar)
Locked