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.

After split my bot put ban *!*@*

Help for those learning Tcl or writing their own scripts.
Post Reply
A
Al
Voice
Posts: 3
Joined: Sat Jul 11, 2009 7:16 am

After split my bot put ban *!*@*

Post by Al »

After the split of one of the servers, and when he is back online, my bot decided to put a ban on this mask *! * @ *.
I looked all your tcl`s seemingly everything is fine
bother me only one tcl.
Eggdrop version:1.6.21

Code: Select all

bind join - "*" badident

proc badident {nick host hand chan} {
 if {[matchattr $hand X]} {
  putlog "14Защитен потребител:15 $nick ($host)" 
  return 0
}
   if {![isbotnick $nick] && [botisop $chan]} {
    if {[regexp {^~[a-z]{1}[0-9]{2,5}$} [lindex [split $host @] 0]]} {
      newchanban $chan *!*@[lindex [split $host @] 1] $::botnick "proxyta sa zabraneni" 60
      }
   }
} 
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Most likely it doesn't find find any host to ban.

A quick fix would be replacing:

Code: Select all

newchanban $chan *!*@[lindex [split $host @] 1] $::botnick "proxyta sa zabraneni" 60 
with:

Code: Select all

set banMask "*!*@[lindex [split $host @] 1]"
if {![string match -nocase $banMask $::botname]} {
	newchanban $chan $banMask $::botnick "proxyta sa zabraneni" 60
}
that will match the ban with it's host. the *!*@* will match him and thus avoid banning itself.
Once the game is over, the king and the pawn go back in the same box.
A
Al
Voice
Posts: 3
Joined: Sat Jul 11, 2009 7:16 am

Post by Al »

can't read "chan": no such variable
while executing
"botisop $chan"
invoked from within
"if {![isbotnick $nick] && [botisop $chan]} {
if {[regexp {^~[a-z]{1}[0-9]{2,5}$} [lindex [split $host @] 0]]} {
set banMask "*!*@[lindex [spl..."
(file "scripts/ident.tcl" line 8)
invoked from within
"source scripts/ident.tcl"
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

How dose the code look like now? It shouldn't give you that error..
Once the game is over, the king and the pawn go back in the same box.
A
Al
Voice
Posts: 3
Joined: Sat Jul 11, 2009 7:16 am

Post by Al »

Code: Select all

bind join - "*" badident 

proc badident {nick host hand chan} { 
}
 if {[matchattr $hand X]} { 
  putlog "14Защитен потребител:15 $nick ($host)" 
  return 0 
} 
   if {![isbotnick $nick] && [botisop $chan]} { 
    if {[regexp {^~[a-z]{1}[0-9]{2,5}$} [lindex [split $host @] 0]]} { 
     set banMask "*!*@[lindex [split $host @] 1]" 
       if {![string match -nocase $banMask $::botname]} { 
   newchanban $chan $banMask $::botnick "proxyta sa zabraneni" 60 
} 
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

No wonder it's misfiring. Try with this:

Code: Select all

bind join - "*" badident

proc badident {nick host hand chan} {
	if {[matchattr $hand X]} {
		putlog "14Защитен потребител:15 $nick ($host)" 
		return 0
	}
	if {[isbotnick $nick] || ![botisop $chan]} return
	if {[regexp {^~[a-z]{1}[0-9]{2,5}$} [lindex [split $host @] 0]]} {
		set banMask "*!*@[lindex [split $host @] 1]"
		if {![string match -nocase $banMask $::botname]} {
			newchanban $chan $banMask $::botnick "proxyta sa zabraneni" 60
		}
	}
}
Once the game is over, the king and the pawn go back in the same box.
Post Reply