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.

a little ban problem

Help for those learning Tcl or writing their own scripts.
Post Reply
A
AskMe
Voice
Posts: 23
Joined: Wed Apr 11, 2007 4:22 pm
Location: Canada

a little ban problem

Post by AskMe »

i have take a existing script and modify it a little bit...
maybe the structure is not very good but it work exept for 1 thing

Code: Select all

bind pub f !spam uw:spamkb

proc uw:spamkb {nick host hand chan text} {
	global botnick
	set rsn SPAM
	uw:ban $nick $host $hand $chan $text
}

proc uw:ban {nick host hand chan text} {
global botnick uw:spamkb rsn uw:viruskb 
set target [lindex $text 0]
set reason [lindex $rsn 0 end]
set bhost [getchanhost $target $chan]
set banmask "*!*@[lindex [split $bhost @] 1]" 
if {[matchattr $target fmo|fmo $chan]} {return 0}
if {[matchattr $nick n|-] == "1"} {
  putserv "MODE $chan +b $banmask"
  putserv "KICK $chan $target :$reason"
  } elseif {$target != $botnick} {
if {[matchattr $target n|-] == "0"} {
if {[matchattr $target fmo|fmo $chan]} {return 0}
 if {[matchattr $nick -|o $chan] == 1} {
  putserv "MODE $chan +b $banmask"
  putserv "KICK $chan $target :$reason"
   } elseif {[matchattr $target -|o $chan] == 0} {
  putserv "MODE $chan +b $banmask"
  putserv "KICK $chan $target :$reason"
  } else {
  putserv "NOTICE $nick : You don`t have permission to kick the Op $target"
 }
} elseif {[matchattr $target n|-] == 1} {
    putserv "NOTICE $nick : You don`t have permission to kick the Op $target"
}
} else {
 putquick "NOTICE $nick : [censored] you"
}
}
if i make !spam nick in the channel it ban like a want.. ex: *!*@host

but if a make the command with a nick who isnt in the chan anynore the bot place a ban *!*@ and thats the part i dont want...

i know its a little thing but i cant find how to resolve it.... its probably a if command but i cant find the variable (im a neeb in tcl] ;)

i want to keep those flag

Code: Select all

if {[matchattr $target fmo|fmo $chan]} {return 0}
so probably this is going to garbage

Code: Select all

if {[matchattr $nick n|-] == "1"}
if {[matchattr $target n|-] == "0"}
 if {[matchattr $nick -|o $chan] == 1}
} elseif {[matchattr $target n|-] == 1}
i juste whant to keep de kick/ban procedure in proc uw:ban and protect the fmo flag from beeing ban...

and if you have some idea how to improve or simplify the script all the commentary are welcome

thanks[/code]
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Simplest thing would be to add a new test:

if {![onchan $target $chan]} {putcmdlog "'target' isn't on '$chan'";return 0}
Post Reply