| View previous topic :: View next topic |
| Author |
Message |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 8:43 am Post subject: autop after voice by chanserv |
|
|
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! |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 21, 2011 9:08 am Post subject: |
|
|
| Code: |
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. |
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 1:22 pm Post subject: |
|
|
| could u possible put to op the user only if the bot is the only op |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 21, 2011 1:43 pm Post subject: |
|
|
| Code: |
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. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Mon Feb 21, 2011 3:28 pm; edited 1 time in total |
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 3:04 pm Post subject: |
|
|
ty, u rock  |
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 3:15 pm Post subject: |
|
|
actually i get this error
[18:17] Tcl error [chanserv:voice]: wrong # args: no script following "{!$count}" argument |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 21, 2011 3:29 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 3:38 pm Post subject: |
|
|
its not sitting in channel, i get this now
Tcl error [chanserv:voice]: wrong # args: extra words after "else" clause in "if" command |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 21, 2011 3:55 pm Post subject: |
|
|
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: |
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.  _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Mon Feb 21, 2011 4:42 pm; edited 4 times in total |
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 4:02 pm Post subject: |
|
|
| hehe yeah, its working now with the except that always ops the user even if there more ops besides the bot |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Mon Feb 21, 2011 4:04 pm Post subject: |
|
|
| Code: | 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 _________________ speechles' eggdrop tcl archive
Last edited by speechles on Mon Feb 21, 2011 4:25 pm; edited 11 times in total |
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 4:07 pm Post subject: |
|
|
didnt op the user that one
PS: btw could it be to just one #chan instead of all pls ty |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 21, 2011 4:14 pm Post subject: |
|
|
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: |
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. |
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Mon Feb 21, 2011 4:22 pm Post subject: |
|
|
| im sry again, its not oping the user, doesnt give any errors |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 21, 2011 4:26 pm Post subject: |
|
|
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: |
bind mode * "#channel +v" chanserv:voice
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|