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!
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 8:43 am
hello, can someone make a script that will op anyone that's voiced by "Chanserv" when there's only the bot opped?
example:
*** join: user1
*** Chanserv sets mode: +v user1
*** bot sets mode: +o user1
ty in advance!
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Feb 21, 2011 9:08 am
Code: Select all
bind mode * "% +v" chanserv:voice
proc chanserv:voice {nick uhost hand chan mode target} {
if {$nick != "ChanServ"} return
pushmode $chan +o $target
}
This should do the trick.
Once the game is over, the king and the pawn go back in the same box.
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 1:22 pm
could u possible put to op the user only if the bot is the only op
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Feb 21, 2011 1:43 pm
Code: Select all
bind mode * "% +v" chanserv:voice
proc chanserv:voice {nick uhost hand chan mode target} {
if {$nick != "ChanServ"} return
set count 0
set users [chanlist $chan]
foreach user $users {
if {[isbotnick $user]} continue
if {[isop $user $chan]} break
}
if {!$count} pushmode $chan +o $target
}
Edit: fixed.
Last edited by
caesar on Mon Feb 21, 2011 3:28 pm, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 3:04 pm
ty, u rock
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 3:15 pm
actually i get this error
[18:17] Tcl error [chanserv:voice]: wrong # args: no script following "{!$count}" argument
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Feb 21, 2011 3:29 pm
I've fixed the above code. Shouldn't I add an except for ChanServ too, or it isn't sitting on your channel?
Once the game is over, the king and the pawn go back in the same box.
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 3:38 pm
its not sitting in channel, i get this now
Tcl error [chanserv:voice]: wrong # args: extra words after "else" clause in "if" command
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Feb 21, 2011 3:55 pm
There's no else statement, so what the %#&$?!? Guess I'm having another bad day..
Looks like TCL is a bit anal about "if {statement} do 1 command" thing. Anyway, here's a version that should comply with it's *rules*:
Code: Select all
setudef flag voiceop
bind mode * "% +v" chanserv:voice
proc chanserv:voice {nick uhost hand chan mode target} {
if {$nick != "ChanServ"} return
if {![channel get $chan voiceop]} return
set count 0
set users [chanlist $chan]
foreach user $users {
if {[isbotnick $user]} {
continue
}
if {[isop $user $chan]} {
incr count
break
}
}
if {!$count} {
pushmode $chan +o $target
}
}
I should get an eggdrop to test stuff from now on.
Edit: Added 'voiceop' flag too.
Last edited by
caesar on Mon Feb 21, 2011 4:42 pm, edited 4 times in total.
Once the game is over, the king and the pawn go back in the same box.
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 4:02 pm
hehe yeah, its working now with the except that always ops the user even if there more ops besides the bot
speechles
Revered One
Posts: 1398 Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)
Post
by speechles » Mon Feb 21, 2011 4:04 pm
Code: Select all
setudef flag voiceop
set chanserv_host "services.somenetwork.net"
bind mode * "% +v" chanserv:voice
proc chanserv:voice {nick uhost hand chan mode target} {
if {[channel get $chan voiceop] && [string equal -nocase "ChanServ" $nick] && ![isop $target $chan] && [botisop $chan] && [string equal -nocase $::chanserv_host [lindex [split $uhost @] 1]]} {
foreach n [chanlist $chan] {
if {![isbotnick $n] && ![string equal -nocase "ChanServ" $n] && [isop $n $chan]} { break } { continue }
pushmode $chan +o $target
}
}
}
This should work
Edit: Forgot to add the exception that bot only OP the user if it is the only one opped in the channel. Also added chanset setting.. to enable.. on partyline: .chanset #yourchan +voiceop
Last edited by
speechles on Mon Feb 21, 2011 4:25 pm, edited 11 times in total.
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 4:07 pm
didnt op the user that one
PS: btw could it be to just one #chan instead of all pls ty
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Feb 21, 2011 4:14 pm
Aww.. i forgot to increment the number of channel operators that have been found (the $count variable). Now it should work properly.
My apologies for the sloppy coding.
Edit: @speechles: There's no need for:
Code: Select all
if {(![isbotnick $n] || ![string equal -nocase "ChanServ" $n]) && [isop $n $chan]} {
break
} elseif {[isbotnick $n] || [string equal -nocase "ChanServ" $n]} {
cos ChanServ isn't sitting on his channel, also, why don't you use just one 'if' statement to exclude the bot and another to check for channel op's?
If you read again what he asked for in the first place you would notice that he wanted the bot to op the user ONLY if the bot is the only channel operator.
Once the game is over, the king and the pawn go back in the same box.
.pt
Halfop
Posts: 71 Joined: Wed Nov 16, 2005 10:14 am
Post
by .pt » Mon Feb 21, 2011 4:22 pm
im sry again, its not oping the user, doesnt give any errors
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Feb 21, 2011 4:26 pm
If you copied my last code you should '.chanset #channel +voiceop' to activate it. I'm getting a bot to play with the bind mode as I'm not 100% sure about the mask, I think I can drop the need of this with something simple as:
Code: Select all
bind mode * "#channel +v" chanserv:voice
Once the game is over, the king and the pawn go back in the same box.