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.

Set a ban in 2 channels...

Old posts that have not been replied to for several years.
Locked
s
superfly

Set a ban in 2 channels...

Post by superfly »

I have this script that I edited, and I'd like to add some type of checking so if a ban is set on a user in the main channel, it will set the ban in the sub channel also... heres the code that I'm using right now,

Code: Select all

############################# 
#  This is the main channel 
############################# 

set om_subc(main) "#mainchannel" 

############################# 
# This is the sub channel 
############################# 

set om_subc(sub) "#subchannel" 

############################# 
#  Warning time, in minutes 
############################# 

set om_subc(warntime) 30 

############################# 
# Warning Message 
############################# 

set om_subc(warnmsg) "You have $om_subc(warntime) seconds to join $om_subc(main) or you will be banned" 

############################# 
# Kick Message 
############################# 

set om_subc(kickmsg) "You were banned from $om_subc(sub) because you have not joined $om_subc(main).  Please join $om_subc(main) to have the ban removed." 

############################# 
#  Unban message 
############################# 

set om_subc(unbannotice) "You have been unbanned from $om_subc(sub) , if you part $om_subc(main) you while in $om_subc(sub) you will be banned again." 

############################# 
# Set the ban type here:    # 
# 1 - *!*@host.domain       # 
# 2 - *!user@host.domain    # 
# 3 - nick!*@host.domain    # 
# 4 - nick!user@host.domain # 
# 5 - *!?user@*.host.domain # 
############################# 

set om_subc(bantype) "1" 

################################### 
# Enable use of bold in DCC chat? # 
################################### 

set om_subc(bold) 1 

######################################### 
# Prefix "SPLIT:" in DCC chat messages? # 
######################################### 

set om_subc(SUBCHAN:) 1 


############################# 
#  Code begin 
############################# 

if {![string match 1.6.* $version]} { putlog "\002SUBCHAN:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.x or later." } 
if {[info tclversion] < 8.2} { putlog "\002SUBCHAN:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." } 

bind join - "$om_subc(sub) *" subchan_checkjoin 
bind join - "$om_subc(main) *" subchan_checkjoin 
bind part - "$om_subc(main) *" subchan_checkpart 

proc subchan_ncm {pattern string} { return [string match [string tolower $pattern] [string tolower $string]] } 
proc subchan_dopre {} { 
   global om_subc 
   if {!$om_subc(SUBCHAN:)} { return "" } 
   if {!$om_subc(bold)} { return "SUBCHAN: " } 
   return "\002SUBCHAN:\002 " 
} 
proc subchan_maskban {nick uhost} { 
   global om_subc 
   switch -- $om_subc(bantype) { 
      1 { set ban "*!*@[lindex [split $uhost @] 1]" } 
      2 { set ban "*!$uhost" } 
      3 { set ban "$nick!*@[lindex [split $uhost @] 1]" } 
      4 { set ban "$nick!$uhost" } 
      5 { set ban [maskhost $uhost] } 
      default { set ban "*!*@[lindex [split $uhost @] 1]" } 
   } 
   return $ban } 

proc subchan_checkjoin {nick uhost hand chan} { 
   global om_subc 
   if {![botisop $om_subc(sub)]} { return } 
   set banmask [subchan_maskban $nick $uhost] 
   if {[subchan_ncm $chan $om_subc(main)]} { 
      if {![ischanban $banmask $om_subc(sub)]} { return } 
       
      regsub -all -- "%mainchan" $om_subc(unbannotice) $om_subc(main) msg 
      regsub -all -- "%subchan" $msg $om_subc(sub) msg 
      pushmode $om_subc(sub) -b $banmask 
       
      if {$msg != ""} { puthelp "NOTICE $nick :$msg" } 
      return } 

   if {[onchan $nick $om_subc(main)] || [matchattr $hand ov|ov $om_subc(main)] || [matchattr $hand ov|ov $om_subc(sub)] || [isvoice $nick $om_subc(main)] || [isop $nick $om_subc(main)]} { return } 
             
   if {![onchan $nick $om_subc(main)]} { 
    
      putserv "NOTICE $nick :$om_subc(warnmsg)" } 
       
   utimer $om_subc(warntime) [list subchan_setJoinban $nick $uhost] 
} 

proc subchan_checkpart {nick uhost hand chan text} { 
   global om_subc 
   set banmask [subchan_maskban $nick $uhost] 
    
   if {![botisop $om_subc(sub)] || ![onchan $nick $om_subc(sub)] || [matchattr $hand vo|vo $om_subc(main)] || [matchattr $hand vo|vo $om_subc(sub)] || [isvoice $nick $om_subc(sub)] || [isop $nick $om_subc(sub)]} { return } 
    
   if {[onchan $nick $om_subc(sub)] } { 
    
      putserv "NOTICE $nick :$om_subc(warnmsg)" } 
    
   utimer $om_subc(warntime) [list subchan_setPartban $nick $uhost ] 
} 

proc subchan_setPartban {nick uhost} { 
   global om_subc 
   set banmask [subchan_maskban $nick $uhost] 
    
   if {![botisop $om_subc(sub)] || ![onchan $nick $om_subc(sub)] || [isvoice $nick $om_subc(sub)] || [isop $nick $om_subc(sub)] || [onchan $nick $om_subc(main)] || [isvoice $nick $om_subc(main)] || [isop $nick $om_subc(main)]} { return } 
          
   putserv "MODE $om_subc(sub) +b $banmask" 
   putserv "KICK $om_subc(sub) $nick :$om_subc(kickmsg)" 
} 

proc subchan_setJoinban {nick uhost} { 
   global om_subc 
   set banmask [subchan_maskban $nick $uhost] 
    
   if {![botisop $om_subc(sub)] || ![onchan $nick $om_subc(sub)] || [isvoice $nick $om_subc(sub)] || [isop $nick $om_subc(sub)] || [onchan $nick $om_subc(main)] || [isvoice $nick $om_subc(main)] || [isop $nick $om_subc(main)]} { return } 
   putserv "MODE $om_subc(sub) +b $banmask" 
   putserv "KICK $om_subc(sub) $nick :$om_subc(kickmsg)" 
} 
    

    

putlog "\002SUBCHAN:\002 OMSubChannel.tcl 1.1 is loaded."
Any help would be appreciated ... SF
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Code: Select all

bind mode - "#main +b" proc_that_bans_in_subchan
s
superfly

still confused =(

Post by superfly »

ok I added this under the rest of the binds...

Code: Select all

bind mode - "$om_subc(main) +b" subchan_checkban
then I made a proc at the bottom...

Code: Select all

proc subchan_checkban {nick uhost hand chan text} { 
   global om_subc
   set banmask [subchan_maskban $nick $uhost]

   putserv "MODE $om_subc(sub) +b $banmask"
   putserv "KICK $om_subc(sub) $nick :$om_subc(mainbanmsg)"
}
but it doesn't seem to be working, any ideas on what I'm missing?

SF
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: still confused =(

Post by user »

superfly wrote:any ideas on what I'm missing?
Yeah. How mode binds work. If you'd check doc/tcl-commands.doc you'd notice the set of arguments passed along from a mode bind is quite different from the ones you have. (the one called "victim" in the docs will be the banmask for your bind)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Your subchan_checkban sounds like a proc for a public bind :lol: Check the tcl-commands.doc file as user sugested. :P
Once the game is over, the king and the pawn go back in the same box.
Locked