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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Sat Aug 26, 2006 4:07 am
Hello Friends, I have this code which enforce bans. I would request if some1 can add something like:
Script shouldn't kick users if the ban mask matchs more than x number of users to prevent masskick. Thanks in advance.
Code: Select all
bind mode - "* +b" enforcebans
proc enforcebans {nick uhost hand chan mc ban} {
if {![botisop $chan]} {return}
if {![string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $::botname]} {
foreach n [chanlist $chan] {
if {[string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $n![getchanhost $n $chan]]} {
putkick $chan $n "1Banned 4-> $ban 4<- 1By4 $nick - 7,14::: i_m_0off9line :::"
}
}
} else {
pushmode $chan -o $nick
}
}
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Wed Sep 13, 2006 5:13 am
Strange 83 views and not even single help
can some1 please help in this regards. thx
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Sep 13, 2006 2:36 pm
Code: Select all
set enforce(max) "5"
set enforce(rsn) "Banned %ban by %nick"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce
if {![botisop $chan]} {return}
if {![string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $::botname]} {
foreach n [chanlist $chan] {
if {[string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $n![getchanhost $n $chan]]} {
lappend list $n
}
}
if {[llength $list] > $enforce(max)} return
putkick $chan [join $list {,}] [subst $enforce(rsn)]
} else {
pushmode $chan -o $nick
}
}
Give this a try.. not tested..
Edit: Seems that I've also forgoten to add some variables used in the script.. Fixed now, also, not tested.
Last edited by
caesar on Thu Sep 14, 2006 3:10 pm, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Thu Sep 14, 2006 2:43 am
if {[llength $list] > $enforce(max)} return <---- is it (max) where I shall define maximum number of bans?
something like:
if {[llength $list] > $enforce( 8 )} return (with no space)
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Thu Sep 14, 2006 8:44 am
Code: Select all
set enforce(max) 8
proc enforcebans {nick uhost hand chan mc ban} {
global enforce
if {![botisop $chan]} {return}
if {![string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $::botname]} {
foreach n [chanlist $chan] {
if {[string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $n![getchanhost $n $chan]]} {
lappend list $user
}
}
if {[llength $list] > $enforce(max)} return
putkick $chan [join $list {,}] $enforce(rsn)
} else {
pushmode $chan -o $nick
}
}
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Thu Sep 14, 2006 9:26 am
ohh thanks, so sweet of u guys
will give a try and get back. thx
Tried both the codes, but they both r showing error:
1Tcl error [enforcebans]: can't read "user": no such variable
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Thu Sep 14, 2006 3:07 pm
My bad, forgot to change from:
to this:
Also fixed my previous code.
Once the game is over, the king and the pawn go back in the same box.
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Sat Sep 16, 2006 3:58 am
thx a lot for update caesar
It still seems to have some bugs. i.e.:
1. It doesn't release the ban or deop the nick who sets the ban more than max.
2. if ban mask doesn't exceed the limit - on kick msg it shows like "3(Banned %ban by %nick)" instead of banned mask or nick who banned.
Thx in advance.
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Sat Sep 16, 2006 6:50 am
Change:
Code: Select all
if {[llength $list] > $enforce(max)} return
putkick $chan [join $list {,}] $enforce(rsn)
} else {
pushmode $chan -o $nick
}
To:
Code: Select all
if {[llength $list] > $enforce(max)} {
pushmode $chan -ob $nick $ban
} else {
putkick $chan [join $list ,] :[string map { %ban $ban %nick $nick } $enforce(rsn)]
}
r0t3n @ #r0t3n @ Quakenet
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Sat Sep 16, 2006 7:30 am
after making changes as suggested by tosser, it gives error like
(file "scripts/enforcebans.tcl" line 4)
& disconnects the bot
I realize there was one "}" missing, which I added at the end of code and tried, but it doesn't react at all.
Maybe "}" should be placed elsewhere. Please suggest. if I m wrong.
Thx for all ur afforts n try in advance.
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Sat Sep 16, 2006 8:07 am
Code: Select all
bind mode - "* +b" enforcebans
set enforce(max) "8"
set enforce(kmsg) "Banned %ban by %nick"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match -nocase $ban $botname]} { return }
set list ""
foreach user [chanlist $chan] {
if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
} else {
if {[llength $list] <= "3"} {
putkick $chan [join $list ,] :[string map {"%ban" "$ban" "%nick" "$nick"} $enforce(kmsg)]"
} else {
set nlist ""
foreach x $list {
lappend nlist $x
if {[llength $nlist] == "3"} {
putserv "KICK $chan [join $nlist ,] :[string map {"%ban" "$ban" "%nick" "$nick"} $enforce(kmsg)]"
set nlist ""
}
}
if {[llength $nlist] != ""} {
putserv "KICK $chan [join $nlist ,] :[string map {"%ban" "$ban" "%nick" "$nick"} $enforce(kmsg)]"
set nlist ""
}
}
}
}
putlog "Enforcebans loaded."
Not tested.
Added in kick flood protection, only 3 users kicked at a time. If not needed, just remove it.
r0t3n @ #r0t3n @ Quakenet
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Sat Sep 16, 2006 8:41 am
wow thats working charm & almost perfect as I expected
thx a lot
Only one problem is with kick msg, its showing kick msg as:
3(:Banned $ban by $nick")
Please see if u can do something about it :s thx a lot
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Sat Sep 16, 2006 9:11 am
Try:
Code: Select all
bind mode - "* +b" enforcebans
set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match -nocase $ban $botname]} { return }
set kickmsg "$enforce(kmsg)"
regsub -all :ban: $kickmsg $ban kickmsg
regsub -all :nick: $kickmsg $nick kickmsg
set list ""
foreach user [chanlist $chan] {
if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
} else {
if {[llength $list] <= "3"} {
putserv "KICK $chan [join $list ,] :$kickmsg"
} else {
set nlist ""
foreach x $list {
lappend nlist $x
if {[llength $nlist] == "3"} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
if {[llength $nlist] != ""} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
}
}
putlog "Enforcebans loaded."
r0t3n @ #r0t3n @ Quakenet
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Sat Sep 16, 2006 11:54 am
wooooooooow that works cooool like what exactly I wanted. Thanks a lot mate
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Wed Sep 20, 2006 5:39 am
sorry for bothering again, if I want to exempt Bot users from being kicked as well, how can I add it? Please suggest so I will give a try. Thx