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!
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Wed Sep 20, 2006 8:58 am
i.m.offline wrote: 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
Code: Select all
matchattr <handle> <flags> [channel]
Returns: 1 if the specified user has the specified flags; 0 otherwise
For a list of the user flags type the following in the party line:
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Sat Sep 23, 2006 7:21 am
is it something like
if {[matchattr $hand o]} { return 1 }
where do I have to add this line, tried adding some places but couldn't make it work :/
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Sat Sep 23, 2006 10:37 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 kickmsg "$enforce(kmsg)"
regsub -all :ban: $kickmsg $ban kickmsg
regsub -all :nick: $kickmsg $nick kickmsg
set list ""
foreach user [chanlist $chan] {
if {[matchattr [nick2hand $user] f|f $chan]} { return }
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."
It will excempt bot users with the global and channel flag +f (friend flag).
r0t3n @ #r0t3n @ Quakenet
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Sat Sep 23, 2006 11:09 am
thanks for the help mate, but for some od reason, it doesn't kick at all nor it removes ban mask from flagged users :s despite of user being flagged or not.
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Wed Sep 27, 2006 8:59 am
i have tried making few changes but still couldn't make it work. please help :/ thx
honeybee
Halfop
Posts: 80 Joined: Sun Jan 01, 2006 12:42 pm
Post
by honeybee » Wed Sep 27, 2006 7:29 pm
Code: Select all
bind mode - "* +b" enforcebans
set enforce(max) "8"
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 {[matchattr [nick2hand $user] f|f $chan]} { return }
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"
}
}
}
putlog "Enforcebans loaded."
So this can only be used to check if a banned host is banning more than 8 users and what if i also wana check if its banning *!*@* so i can do it more quick, thanks if this code can be more better.
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Thu Sep 28, 2006 2:31 am
when I tried using this code the bot quits giving error msg
invalid command name "}"
while executing
"}"
(file "scripts/enforcebans.tcl" line 22)
invoked from within
ya it should prvent *!*@* banmask too. thx in advance.
krimson
Halfop
Posts: 86 Joined: Wed Apr 19, 2006 8:12 am
Post
by krimson » Thu Sep 28, 2006 3:41 am
you have an extra closing bracket at the end of the script.. remove that and try again
i.m.offline
Halfop
Posts: 74 Joined: Thu Mar 02, 2006 11:47 am
Post
by i.m.offline » Thu Sep 28, 2006 4:31 am
thx for the suggestion krimson
I did give try for that earlier. Bot doesn't react at all for this code. it doesn't kick at all for whatsoever mask it is.
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Thu Sep 28, 2006 6:11 am
Try This:
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 ""
set continue "1"
foreach user [chanlist $chan] {
if {[matchattr [nick2hand $user] f|f $chan]} {
putserv "MODE $chan -b $ban"
putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
set continue "0"
break
if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
} 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 » Thu Sep 28, 2006 8:05 am
bot quit with error
Code: Select all
[08:04] missing close-brace
while executing
"proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "..."
(file "scripts/enforcebans.tcl" line 6)
:/ thx for trying mate n sparing time for me
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Thu Sep 28, 2006 9:01 am
This code should work:
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 ""
set continue "1"
foreach user [chanlist $chan] {
if {[matchattr [nick2hand $user] f|f $chan]} {
putserv "MODE $chan -b $ban"
putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
set continue "0"
break
} elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
} 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 » Thu Sep 28, 2006 1:32 pm
now its releasing all the bans set by anyone
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Fri Sep 29, 2006 6:50 am
Ok, this should be the last one now:
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 ""
set continue "1"
foreach user [chanlist $chan] {
if {![string match -nocase $nick $user] && [matchattr [nick2hand $user] f|f $chan] && ![isbotnick $user]} {
putserv "MODE $chan -b $ban"
putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
set continue "0"
break
} elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
} 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
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Fri Sep 29, 2006 5:28 pm
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]} {
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match $ban $botname]} {
return 0
}
set reason [string map [list ":ban:" "$ban" ":nick" "$nick"] $enforce(kmsg)
set list [list]
set continue 1
foreach user [chanlist $chan] {
if {[isbotnick $user]} {
continue
} elseif {[matchattr [nick2hand $user] f|f $chan]} {
pushmode $chan -b $ban
set continue 0
break
} elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[set llist [llength $list]]} {
if {$llist > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
} else {
if {$llist <= 3} {
putserv "KICK $chan [join $list ,] :$reason"
} else {
for {set i 0;set temp [list];set j 0} {$i <= $llist} {incr i} {
if {$j == 3 || $i == $llist} {
if {$j > 0} {
putserv "KICK $chan [join $temp ,] :$reason"
set temp [list]
set j 0
if {$j == $llist} {
break
}
}
lappend temp [lindex $list $i]
incr j
}
}
}
}
}
}
}
}
Should work fine. [untested]