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.

Join chan, get op'd in diff chan

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
r
romprod
Halfop
Posts: 49
Joined: Fri Oct 19, 2001 8:00 pm

Join chan, get op'd in diff chan

Post by romprod »

Hey guys, i'm looking for a script that will op an user in #a when they join #b automatically.

I've had a look around and chan't seem to find any, any help would be apreciated.

Thnks
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

Code: Select all

bind join - "#b *" chanJoin

proc chanJoin {nick host hand chan} {
  if { [validchan #a] && [botisop #a] && [onchan $nick #a] } {
    pushmode #a +o $nick
  }
}
r
romprod
Halfop
Posts: 49
Joined: Fri Oct 19, 2001 8:00 pm

Post by romprod »

Thanks for that, works a treat.

Is it possible to make it check #b and if they're allready in that channel, op on join of #a?

Also if the user is not in #b it de-op's in #a if allready op'd?
r
romprod
Halfop
Posts: 49
Joined: Fri Oct 19, 2001 8:00 pm

Post by romprod »

Code: Select all

bind mode - *+o* opCheck

proc opCheck {nick host hand chan} {
  if { [validchan #a] && [botisop #a] && [validchan #b] && [onchan $nick #a] } {
    if {[isop $nick #b] == 0} {
      putmsg #b "$nick is got opped in #a and is not in this chan"
      pushmode #a -o $nick
      putserv "kick #a $nick :Permission denied!!"
    } 

  }
}
Can anybody see anything wrong with this? I get the following error message

Tcl error [opCheck]: wrong # args: should be "opCheck nick host hand chan"
User avatar
krimson
Halfop
Posts: 86
Joined: Wed Apr 19, 2006 8:12 am

Post by krimson »

(14) MODE (stackable)
bind mode <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <mode-change> <victim>
you lack two arguments in the proc. using the model above would fix your problem
Last edited by krimson on Wed May 17, 2006 2:03 am, edited 1 time in total.
r
romprod
Halfop
Posts: 49
Joined: Fri Oct 19, 2001 8:00 pm

Post by romprod »

Sorry, i know nothing about tcl, can you guys point out the changes i would have to make to the script. I had a quess as to what i would need to do but i'm obviously wrong.

thnx
User avatar
krimson
Halfop
Posts: 86
Joined: Wed Apr 19, 2006 8:12 am

Post by krimson »

replace the proc header

Code: Select all

proc opCheck {nick host hand chan} {
with

Code: Select all

proc opCheck {nick host hand chan mode victim} {
you could also optimise the proc a little:

Code: Select all

bind mode - +o opCheck 

proc opCheck {nick host hand chan mode victim} {
    if {[botisop #a] && [onchan $victim #a]} {
        if {[validchan #b] && ![isop $victim #b]} {
            puthelp "PRIVMSG #b :$victim got opped in #a and is not in this chan"
            pushmode #a -o $victim
            putkick #a $victim Permission denied!!
        }
    }
}
if i'm correct, you wouldn't need to check if #a is a valid chan.. if it isn't, then the bot wouldn't be opped in it, so the whole proc would not run
Post Reply