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.

Anti Join Part with +R if multiple JoinParts

Help for those learning Tcl or writing their own scripts.
Post Reply
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Anti Join Part with +R if multiple JoinParts

Post by simo »

greetz ,

im using this tcl wich checks join parts and sets ban if they join and part within 3 seconds and if multiple nicks join part it sets +R as well, but for some reason it sets +R even if a nick (who was already on channel) just parts and then a join part happens by another nick right after that while we only want a +R set if multipl nicks are join parting within lets say 5 seconds while we check for join parts itselve if its within 3 seconds to set ban

this is what we work with atm:

Code: Select all



bind part - * join-part:flooding

proc join-part:flooding {nick uhost hand chan arg} {
  global botnick jpartfld ChanJPFlood
 
 
 
  if {[isbotnick $nick] || ![botisop $chan]} { return  }
  if {[matchattr $hand b] || [matchattr $hand fom|fom $chan]} { return  }
 
 
 if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-2}]} {





           set TargHost "*!*@[lindex [split $uhost @] 1]"
           if {![ischanban $TargHost $chan]} { pushmode $chan +b $TargHost } 
             
         incr jpartfld($chan) 
          if {![info exists ::jpartfldchk($chan)]} {  set ::jpartfldchk($chan) [after [expr {20*1000*1}] [list unset -nocomplain ::jpartfldchk($chan)]]  }
          if {$jpartfld($chan) >= 2} { jpflod:lock2024 $chan $TargHost ; set jpartfld($chan) 0 ; return 0 }
 
  }
 }


proc JP:flood:list u {
 global ChanJPFlood
  if {[info exists ChanJPFlood($u)]} { incr ChanJPFlood($u) -1 }
}


proc jpflod:lock2024 {chan banmask} {
    global jpflnick_flooded
  if {![info exists jpflnick_flooded($chan)]} {
    set jpflnick_flooded($chan) 1
    if {![regexp R [getchanmode $chan]]} { pushmode $chan +R }
    if {![regexp M [getchanmode $chan]]} { pushmode $chan +M }
     after [expr {10*1000*1}] [list jpflod:unlock2024 $chan]
    utimer 5 [list unset -nocomplain ::jpflnick_flooded($chan)]
  }
}



 proc jpflod:unlock2024 {chan} {
    global unbanjpflnick_flooded
  if {![info exists unbanjpflnick_flooded($chan)]} {
    set unbanjpflnick_flooded($chan) 1
    if {[regexp R [getchanmode $chan]]} { pushmode $chan -R }
    if {[regexp M [getchanmode $chan]]} { pushmode $chan -M }
    utimer 5 [list unset -nocomplain ::unbanjpflnick_flooded($chan)]
  }
}


it doesnt seem to unset the multiple join part section properly so even minutes later if a single join part occurs it sets a +R
Post Reply