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.

Op Limit

Old posts that have not been replied to for several years.
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Op Limit

Post by AbuAli »

hello, i try to find this tcl but i dont find.. help me to write the code plz,

i need to make a limit of ops on my channel .. limit 8 when have 9 ops. deop the 9 op .. and send a msg on the channel.
and if any one deop the bot ... make him reop him self.

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

Post by awyeah »

You can do something similar or like this.
First you need to check for people getting opped, meaning you have to bind to the +o mode.

Code: Select all

bind mode - "*+o*" your_procedure
In your procedure you can also put a condition like:

Code: Select all

if {($mode == "+o")}

Then for counting the number of total ops and deoping the extra ones:

Code: Select all

  set totaltops 0; set list [list] 
  foreach user [chanlist $chan] { 
    if {[isop $user $chan]} {
     inr totalops; lappend list $user
       }
     }
     if {($totalops > 8)} {
       then from there on you can deop the 
       last op nick found by: set deopnick [lindex $list 8]
       or if there is more than one extra op then
       you can deop all the extra ones by using:
       set deopnicks [lrange $list 8 end]
        if {([botisop $chan])} {
       putserv "MODE $chan -o $deopnick" #(if there is one extra op)
       putserv "MODE $chan -oooooo $deopnicks" #(if more than one extra op)
       #For sending a message to the channel you can use:
       putserv "PRIVMSG $chan :More than 8 ops arent allowed on $chan, so $deopnick has been deoped."
       }
     }
   }
For reoping the bot when it is deoped, Download a script
named 'ChanServ Auto Reop Script' by awyeah.
It is present in the TCL archive of www.egghelp.org/tcl.htm
You can get it from there, it will reop your bot with ChanServ
if some one deops it.


Try to implementing this, if you can.
It should do what you want.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

Sorry awyeah,
but i dont know how to code tcls :( so plz help me .. type the code.. i will load it with out change anything.

and i need to set the channel, and set the max ops..
any one get op deop him, if pass the max
and send a msg on the channel
thats it
thx
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

About the 'ChanServ Auto Reop Script' by awyeah
the services on my network dont accept msgs ..

Code: Select all

putserv "PRIVMSG $chanservices :OP $channel $botnick" 
-irc.brasnet.org- For this service please use /ChanServ
so what i have to change on the autoreop.tcl to work...

and about the op limit.. plz help me to write the code.
thx
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yeah it happens.

Set the variable:

set chanservices "chanserv@your.network.services"
instead of setting it "chanserv".

For example on DALnet, I use:

Code: Select all

set chanservices "chanserv@services.dal.net"
Or maybe you can replace:

Code: Select all

putserv "PRIVMSG $chanservices :OP $channel $botnick" 
With the code:

Code: Select all

putserv "$chanservices OP $channel $botnick" 
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Ok... here by requesting me alot I've done this script for you. But there still might be errors. Because I have made the script in less than 5 minutes.

Maybe... syntax errors.

Code: Select all

#Set channels for this script to work on.
#To use all channels the bot is on, set this as "*".
set checkchans "#chan1 #chan2"

#Set the maximum number of channel ops to allow.
#If they are greater than this, then the last one will be deoped.
set maxops "8"

bind mode - "*+o" check:ops

proc check:ops {nick uhost hand chan mode target} {
 global botnick checkchans maxops
  set totalops 0; set list [list]
  if {($mode == "+o")} {
  if {(([lsearch -exact [string tolower $checkchans] [string tolower $chan]] != -1) || ($checkchans == "*"))} {
  foreach user [chanlist $chan] { 
   if {[isop $user $chan]} { 
    inr totalops; lappend list $user 
     } 
    } 
    if {($totalops > $maxops)} { 
    set deopnick [lindex $list 8] 
    if {([botisop $chan]) && ($deopnick != "")} { 
     putserv "MODE $chan -o $deopnick"
     putserv "PRIVMSG $deopnick :<your message here>"
    }
   }
  }
 } 
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

awyeah

Post by AbuAli »

Tcl error [check:ops]: invalid command name "inr"
something rong ?

Code: Select all

inr totalops; lappend list $user
d
dollar
Op
Posts: 178
Joined: Tue Oct 28, 2003 3:47 pm
Location: Netherlands

Re: awyeah

Post by dollar »

abuali wrote:
Tcl error [check:ops]: invalid command name "inr"
something rong ?

Code: Select all

inr totalops; lappend list $user
Yah, change inr to incr.
dollar (or something similar) at:
#eggdrop / #tcl - undernet
#egghelp / #tcl / #eggtcl - efnet
#eggdrop.support / #tcl - quakenet
#eggdrop - ircnet
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

yeah, its working!! thx to all who help to make this good .. "awyeah"

when i change this.. its working

Code: Select all

    set deopnick [lindex $list 8] 
to

Code: Select all

    set deopnick [lindex $list $maxops] 
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yeah, that should do it as well.
You asked for 8 so I set it to 8.
But then I made a variable out of it so
users can define their own and forgot to
change that.

I'll release this in the form of a script with
more functions and settings in a few days,
also same for voices as well.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

awyeah

Post by AbuAli »

Hello, another problem.. on my network chanserv give to 2 users ops on the same line.. like
* ChanServ sets mode: +oo nick1 nick2
* botnick sets mode: -o nick1
so he dont see the nick2 when get op.. he keep the nick2 op.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Replace these lines:

Code: Select all

Use: set deopnicks [lrange $list $maxops end]
and: putserv "MODE $chan -oooooo $deopnicks"
This will deop more than one nick. If there are
supposingly 10 ops or more. It can deop upto
6 people at a time, which is sufficient I think.

That should do it.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

awyeah wrote:Replace these lines:

Code: Select all

Use: set deopnicks [lrange $list $maxops end]
and: putserv "MODE $chan -oooooo $deopnicks"
This will deop more than one nick. If there are
supposingly 10 ops or more. It can deop upto
6 people at a time, which is sufficient I think.

That should do it.
I can see your thought process, and what you thought you were doing was what you were supposed to be doing, and was a nice attempt.. However, when the putserv is called, that text is (as you know) sent to server... and as I think you intended, deopnicks is a TCL List, which the server won't understand (when there are certain characters in a list, Tcl surrounds that list element with {}'s, and as such, the server will look for nicks with those {}'s around them, and won't find them)... As such, you'll want to make your list a string...

Code: Select all

putserv "MODE $chan -oooooo [join $deopnicks]"
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yes someone once told me, in the begining when I started, the easiet way to escape special characters, either use a filter or first split and then join the string. However if it is a list I don't think we would need to split it again, just join it.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

hello, i dont know what the problem..
but some times the bot do his jop prefect.
and some times he make a mesteks.
like deop another op.. not the last who get op
or dont deop any one.
humm, i think he is crazy.. so what the bug .. am useing this code

Code: Select all

set checkchans "#Channel"
set maxops "8"

bind mode -  "*+o" check:ops

proc check:ops {nick uhost hand chan mode target} {
 global botnick checkchans maxops
  set totalops 0; set list [list]
  if {(([lsearch -exact [string tolower $checkchans] [string tolower $chan]] != -1) || ($checkchans == "*"))} {
  foreach user [chanlist $chan] {
    if {[isop $user $chan]} {
     incr totalops; lappend list $user
       }
     }
     if {($totalops > $maxops)} {
      set deopnick [lrange $list $maxops end]
       if {([botisop $chan]) && ($deopnick != "")} {
       putserv "MODE $chan -oooooo $deopnick"
       putserv "PRIVMSG $chan :$deopnick O Limit de Operadores no Canal e $maxops "
       }
     }
   }
}
putlog "OpLimit By awyeah - LOADED"
Locked