| View previous topic :: View next topic |
| Author |
Message |
tonyokc Voice
Joined: 03 May 2004 Posts: 11
|
Posted: Tue Jul 17, 2007 2:22 pm Post subject: Help with List Command |
|
|
There are times I need to op all users with the o flag, so I can check the remaining
I have a routine to do it, but it fails on nicks with special characters. I know the fix is the "list" command, but I could sure use a bit of help on where to use it
Any help is appreciated
Tony
| Code: |
# accept .opops <channel> from global n to op all bot known ops
bind dcc n| opops opops
proc opops {h id chan} {
global botnick
set members [chanlist $chan]
putdcc $id $members
foreach who $members {
if {![isop $who $chan] && [matchattr [nick2hand $who $chan] o|o $chan] } { lappend opnicks $who }
}
set dumps [expr {[llength $opnicks] / 6} ]
putdcc $id "op oping $chan"
set i 0
while { $i < [llength $opnicks]} {
putquick "MODE $chan +oooooo [lrange $opnicks $i [expr {$i + 5} ]]"
set i [expr {$i +6}]
}
}
|
|
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Tue Jul 17, 2007 3:28 pm Post subject: |
|
|
No need for the while loop, when you have a foreach loop...
| Code: | bind dcc n| opops opops
proc opops {h id chan} {
global botnick
set members [chanlist $chan]
putdcc $id $members
set opnicks ""
set dumps 0
putdcc $id "op oping $chan"
foreach who $members {
if {![isop $who $chan] && [matchattr [nick2hand $who] o|o $chan] } {
lappend opnicks $who
incr dumps 1
if {[llength $opnicks] == "6"} {
putquick "MODE $chan +oooooo [join $opnicks " "]"
unset opnicks
}
}
}
if {[[length $opnicks] >=1} {
putquick "MODE $chan +[string repeat "o" [llength $opnicks]] [join $opnicks " "]"
unset opnicks
}
set dumps [expr {$dumps / 6}]
} |
Not tested. _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Tue Jul 17, 2007 6:51 pm Post subject: Re: Help with List Command |
|
|
| tonyokc wrote: | I have a routine to do it, but it fails on nicks with special characters. I know the fix is the "list" command, but I could sure use a bit of help on where to use it
|
http://www.peterre.info/characters.html |
|
| Back to top |
|
 |
|