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.

Couldn't count properly.

Old posts that have not been replied to for several years.
Locked
S
Stafford

Post by Stafford »

Hi, I've got this code and I hope someone could help me out with it.
if {($opmecom == "") && ([matchattr $hand omnpcbt]) || ([matchattr $hand omnpcbt $chan]) == 1 && ([string match #* $arg]) == 0} {
set copc 0
foreach c [channels] {
if {[onchan $nick $c] == 0} {
pushmode $c +o $nick
incr copc
}
}
puthelp "NOTICE $nick :** Opped you on $copc channels."
It works fine if the user is on all channels the eggdrop is in. However, if the user is not on 1 of the channel the eggdrop is in, the part "incr copc" couldn't count properly. It would give the 'puthelp' notice saying it had opped the user in (a number of channel) when the user uses the command even the user is not in the channel. Any ideas?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Move the puthelp command down one line, and add.
if {$copc} {
above it, and of course, the usual } below the puthelp.
S
Stafford

Post by Stafford »

ppslim, it doesn't seems to fix the problem. When I add
if {$copc} {
There's no respond from the bot. It doesn't reply to the command used. However, if I remove
if {[onchan $nick $c]} {
It doesn't count properly again. Any ideas?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

YUK - I juest noticed, that script is trying to OP the nick, only if he isn;t on the channel.

I won't dare write any code to replace it now, not until the drink wears off (yes, I'm drunk, you wanna make somthign of it)
S
Stafford

Post by Stafford »

Hehe. Ok, let's wait till you're "normal" :razz:
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

if {($opmecom == "") && ([matchattr $hand omnpcbt]) || ([matchattr $hand omnpcbt $chan] == 1) && ([string match #* $arg] == 0)} {
set copc 0
foreach c [channels] {
if {[onchan $nick $c]} {
pushmode $c +o $nick
incr copc
}
}
if {$copc} {
puthelp "NOTICE $nick :** Opped you on $copc channels."
}
}
OK - A couple of issues after fixing this.

You should read up on what each global, and channel user flag is.

Matching against "omnpcbt" as the flags is not very secure. +t flag - This means that a botnet master (some1 witht he rights to link bots, not gain ops).

Note, you state, that the user should have either channel flags, or global flags to gain OPS in all channels. This means, that some1 who has been given channel OP's in one channel, can gain OP's in another channel, regardless of his flags.
j
jedis

Post by jedis »

How would I modify this:

Code: Select all

#####.opall - op's you on all channels the bot is on

bind dcc o opall dcc_opall

proc dcc_opall {handle idx arg} {
set nick [lindex $arg 0]
if {$nick == ""} {
putlog "#$handle# opall"
putdcc $idx "[Faze.h] Please see [b].time opall[b]"
return 0
}
foreach ch [channels] {
putserv "MODE $ch +o $nick"
}
dccbroadcast "!dcc opall! $nick by $handle"
putlog "#$handle# opall $nick"
putlog "[Faze.n] Gave [b]op[b] to [b]$nick[b] on all channels."
return 0
}
So it only OP's a user if they do not already have OP's? As of now, it OP's the user in every channel they are in, regardless of whether or not they have OP's already.

Also, is there a way to add an if statement in there, so global +m can use the command on others, but global +o can only use it on themselves, regardless if they enter a nick or not? Right now, it works so any global op can use the command, and can enter any nickname to give anyone op's.

Thanks
S
Stafford

Post by Stafford »

Ok, so, which way do you recommend? By binding to - or (some|flags)?

Eh-heh.. regarding the incr copc, it doesn't seems to work at all. Any changes for that? :razz:

Thanks

<font size=-1>[ This Message was edited by: Stafford on 2001-12-21 06:05 ]</font>
S
Stafford

Post by Stafford »

ppslim, you missed out here?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

No, I just don;t spend 24 hours a day at the computerm, like so many people think.
Locked