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.

scan and op

Old posts that have not been replied to for several years.
Locked
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

scan and op

Post by avilon »

Hey guys,

i´m looking for a .tcl-script.

Let me explain the situation first:

I have 2 channels, eg. #chan1 & #chan2.
#chan1 is the public channel and #chan2 the closed(k) one.
So I need a script that makes the bot op all users in #chan1 that are in the closed #chan2.

The bot has op in both channels and he should react on the command: !opscan

At the end it should look like this:
In #chan2:
Users: @avilon,@mybot,@userxy
(12:50:14) (@avilon) !opscan
(12:50:14) (@mybot) Scanning...
(12:50:14) (@mybot) Scanning completed.

In #chan1:
Users: @avilon,@mybot,+userxy
(12:50:14) • mybot sets mode (+o userxy)
Please don´t reply like "Take a look at the script archive"... I haven´t found anything comparable.

Thanks
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well this is not a hard thing to do.

What you can do is make a script, to first check users on your opped channel, match them with users on the other chan, then add them to a list, and using pushmode or putserv whatever you can op them.

Now the thing is you might want to trigger this with a pub bind, as there is not other manual way to do it. Or you can trigger it on +o of #channel1 if you like as well.

*** For *** this to work, the bot MUST be on both channels, and it must be opped on #channel2, so it can retrieve the user lists of both channels, compare them and make a seperate list to op the users.

I am not sure, but something like this should definately work:

Code: Select all

### Settings ###

#This will be the channel where the opped users will be detected on.
set chan1 "#opchannel"

#This will be the channel to op the people on.
set chan2 "#chanforop"


### Don't edit anything below this! ###

bind pub n !opscan scan:ops 

proc scan:ops {nick uhost hand chan text} { 
 global botnick chan1 chan2
  if {(![validchan $chan1]) || (![validchan $chan2])} { return 0 }
  if {(![string equal -nocase $chan $chan1]) || (![string equal -nocase $chan $chan2])} { return 0 }
  putserv "PRIVMSG $chan1 :Scanning..."; set oplist [list]
  foreach user [chanlist $chan1] {
   if {([onchan $user $chan1]) && ([onchan $user $chan2])} { 
    lappend oplist $user
    }
   }
   putserv "PRIVMSG $chan1 :Scanning completed."
   if {([llength $oplist] >= 1) && ([botisop $chan2])} {
   putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan2."
    foreach person $oplist {
     pushmode $chan2 +o $person
    }
    flushmode $chan2
    putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] has/have been successfully opped on $chan2.
  }
 return 0
} 
So this will work with anyone (mainly the bot owner) with flag "n", types !opscan on any one of the two channels. Then the bot will detect opped users from channel1 and op those users on channel2.

I haven't tested it though, but I think it will work ;) no doubt!
Give this script a try and let me know :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
K
Voice
Posts: 34
Joined: Wed Jan 28, 2004 7:31 pm
Location: Romania @sibiu
Contact:

check

Post by K »

i have ckeck the script and
1. you forght a " at

Code: Select all

  putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] has/have been successfully opped on $chan2.
2. don't work (don't work means no error message on dcc but if you do !opscan even no message/error on dcc and the bot don't do nothing)
here is the script with the missing "

Code: Select all

### Settings ### 

#This will be the channel where the opped users will be detected on. 
set chan1 "#sibiu" 

#This will be the channel to op the people on. 
set chan2 "#talmaciu" 


### Don't edit anything below this! ### 

bind pub n !opscan scan:ops 

proc scan:ops {nick uhost hand chan text} { 
 global botnick chan1 chan2 
  if {(![validchan $chan1]) || (![validchan $chan2])} { return 0 } 
  if {(![string equal -nocase $chan $chan1]) || (![string equal -nocase $chan $chan2])} { return 0 } 
  putserv "PRIVMSG $chan1 :Scanning..."; set oplist [list] 
  foreach user [chanlist $chan1] { 
   if {([onchan $user $chan1]) && ([onchan $user $chan2])} { 
    lappend oplist $user 
    } 
   } 
   putserv "PRIVMSG $chan1 :Scanning completed." 
   if {([llength $oplist] >= 1) && ([botisop $chan2])} { 
   putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan2." 
    foreach person $oplist { 
     pushmode $chan2 +o $person 
    } 
    flushmode $chan2 
    putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] has/have been successfully opped on $chan2." 
  } 
 return 0 
} 
 

User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Maybe any of the detected conditions is false, not true, so it might return 0, or halt. Would have to check that using putlogs... then it will be easy to check whats halting it.

Looking at it logically it seems, correct hmm.
I guess I would have to test/execute it out to find the problem.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

awyeah wrote:I guess I would have to test/execute it out to find the problem.
Thanks for your help. It would be nice if you found out the bug in this script.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I'll try it out when I am free.
Which is not the case these days :roll:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Stealthx
Halfop
Posts: 68
Joined: Fri Oct 01, 2004 3:37 am
Location: StealthBox

Post by Stealthx »

Hmm, hi, i try this tcl in my bot and sad to say, i found that it doesn't work although it doesn't display any error message... anyone got any similar script like this? :mrgreen:
+ Stealth Box +
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

awyeah wrote:

Code: Select all

if {(![string equal -nocase $chan $chan1]) || (![string equal -nocase $chan $chan2])} { return 0 }
replace "||" with "&&"? :)
Have you ever read "The Manual"?
User avatar
Stealthx
Halfop
Posts: 68
Joined: Fri Oct 01, 2004 3:37 am
Location: StealthBox

Post by Stealthx »

user wrote:
awyeah wrote:

Code: Select all

if {(![string equal -nocase $chan $chan1]) || (![string equal -nocase $chan $chan2])} { return 0 }
replace "||" with "&&"? :)
Thank you! It's working perfectly alright now... :D :mrgreen: :wink:
+ Stealth Box +
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

thanks :)
Locked