bind pub - `power pub:power
proc pub:power { nick host hand channel args } {
global botnick power
set test [chanlist $channel]
# The channels bot is in
set reg($channel) 0
for { set number 0 } { $number < [llength $test] } { incr number } {
if {[onchan $botnick $channel]} {
incr reg($channel)
}
}
# The channels bot is op
set ops($channel) 0
for { set number 0 } { $number < [llength $test] } { incr number } {
if {[botisop [lindex $test $number] $channel]} {
incr ops($channel)
}
}
# The number of users are in chan with bot
set usera($channel) 0
for { set number 0 } { $number < [llength $test] } { incr number } {
if {[onchan $nick $channel]} {
incr usera($channel)
}
}
# The number of users are in chan with bot with no op
set usern($channel) 0
for { set number 0 } { $number < [llength $test] } { incr number } {
if {![isop $nick $channel] } {
incr usern($channel)
}
}
puhelp "PRIVMSG $channel :I'm oped in $ops($channel) channels out of $reg($channel), \
and can fool around with $usern($channel) of $usera($channel)"
}
return 0
}
}
[01:58:08pm] <DarkJFGirl> [17:00] Tcl error [pub:power]: wrong # args: should be "botisop ?channel?"
[02:54:54pm] (DarkJFMan) `power
[02:54:56pm] (DarkJFGirl) I'm oped in 4 channels out of 4, and can fool around with 0 of 4
what i want script to do
<nick>`power
<bot> I'm oped in (how many chans bot is op) channels out of (the chan's he's in), and can fool around with (people that don't got op) of (all the users in same chan with op)
The script is correct, it's just i need to find the right loops.
bind pub - `power pub:power
proc pub:power {nick uhost hand chan text} {
set chnum 0; set chusr 0; set nonop 0
set totch [llength [channels]]
foreach ch [channels] {
if {[botisop $ch]} {
set chn [llength [chanlist $ch]]
incr chusr $chn
incr chnum
foreach u [chanlist $ch] {
if {![isop $u $ch]} { incr nonop }
}
}
}
putserv "PRIVMSG $chan :I'm opped in $chnum out of $totch channels, and can fool around with $nonop out of $chusr users. "
}
my mistake, i didn't tell it correctly, everything is correct except, i need to know how to make "$chusr" count all the nicks that are in same chan with the bot, doesn't matter if they're oped/voice/ or nothing
DarkJFMan wrote:i need to know how to make "$chusr" count all the nicks that are in same chan with the bot, doesn't matter if they're oped/voice/ or nothing