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.
Old posts that have not been replied to for several years.
Gothic-Angel
Op
Posts: 109 Joined: Mon Sep 23, 2002 9:46 pm
Post
by Gothic-Angel » Sun Dec 14, 2003 8:55 am
I want to write a tcl to check when someone's deoped if that person matches a certain flag then deop the person who deoped the protected user and reop the protected user.
Im not really sure where to start, I'd just like hints and tips and snippets of code not someone just saying "do it like this"
I like to learn hehe
Thanks for any help...
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Sun Dec 14, 2003 3:02 pm
Code: Select all
set theflag "m"
bind mode - "* -o" protect:deop
proc protect:deop {nick uhost hand chan mc vict} {
if {[matchattr [nick2hand $vict $chan] $::theflag $chan]} {
# here you add your stuff to do when one of my friends just got deoped..
}
}
Once the game is over, the king and the pawn go back in the same box.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Sun Dec 14, 2003 3:53 pm
Gothic-Angel wrote: What's the use of "mc" in the proc line for?
check tcl-commands.doc (bind mode)
Have you ever read "The Manual"?
Gothic-Angel
Op
Posts: 109 Joined: Mon Sep 23, 2002 9:46 pm
Post
by Gothic-Angel » Sun Dec 14, 2003 6:54 pm
Well I'v got all that and I'v added in a few other things, now Im stuck on ban protection.
It seems Im having a hard time even getting it to trigger the proc I know that my bind on the mode switch is right yet I can't get my proc to trigger.
Care to give me some idea's on how to write up some basic ban protections?
Gothic-Angel
Op
Posts: 109 Joined: Mon Sep 23, 2002 9:46 pm
Post
by Gothic-Angel » Mon Dec 15, 2003 8:58 am
Code: Select all
proc protect:ban {nick uhost hand chan mc vict} {
if {[matchattr [nick2hand $vict $chan] $::theflag $chan]} {
putserv "MODE $chan -o+o $nick $vict"
set Victimhost [getchanhost $vict $chan]
set Victimbanmask "*!*[string range $uhost [string first "@" $Victimhost] end]"
pushmode $chan -b $Victimhost
pushmode $chan -b $Victimbanmask
}
}
Give me some guidance heheh
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Dec 15, 2003 11:30 am
$Victimhost returns ident@host of the victim, then:
Code: Select all
set Victimbanmask "*!*[string range $uhost [string first "@" $Victimhost] end]"
will not return what you want.
it should be:
Code: Select all
set Victimbanmask "*!*[string range $victimhost [string first "@" $Victimhost] end]"
or
Code: Select all
set Victimbanmask *!*@[lindex [split $Victimhost @] 1]
and remove the
pushmode $chan -b $Victimhost line.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Dec 15, 2003 1:31 pm
try this one..
Code: Select all
bind mode - "* +b" protect:ban
proc protect:ban {nick uhost hand chan mc ban} {
if {![botisop $chan]} {
return
}
if {[string match -nocase $ban $::botname]} {
if {[matchattr $hand $::theflag]} {
putquick "MODE $chan -b $ban"
return
}
scan $uhost "%\[^@\]@%s" host
putquick "MODE $chan -bo+b $ban $nick *!*@$host"
newchanban $chan *!*@$host Moron "Don't place bans that matches me moron!" 1440
return
}
foreach luser [chanlist $chan $::theflag] {
if {[string match -nocase $ban $luser![getchanhost $luser $chan]]} {
if {[matchattr $hand mn|mn $chan]} {
putquick "MODE $chan -b $ban"
return
}
scan $uhost "%\[^@\]@%s" host
putquick "MODE $chan -bo+b $ban $nick *!*@$host"
newchanban $chan *!*@$host Moron "Don't place bans that matches one of my friends moron!" 1440
}
}
}
Once the game is over, the king and the pawn go back in the same box.
Gothic-Angel
Op
Posts: 109 Joined: Mon Sep 23, 2002 9:46 pm
Post
by Gothic-Angel » Mon Dec 15, 2003 8:07 pm
Tcl error [protect:ban]: different numbers of variable names and field specifiers
Is the error I keep getting when directly pasting only your code and running it.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Tue Dec 16, 2003 12:33 pm
Yes, noticed that myself.. replace the "scan $uhost "%\[^@\]@%s" host " lines with: scan $uhost "%\[^@\]@%s" user host
Once the game is over, the king and the pawn go back in the same box.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Tue Dec 16, 2003 2:19 pm
caesar wrote: Yes, noticed that myself.. replace the "scan $uhost "%\[^@\]@%s" host " lines with: scan $uhost "%\[^@\]@%s" user host
Or...
.. which is what I think you meant initially (you just left that * out)
Have you ever read "The Manual"?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Tue Dec 16, 2003 3:59 pm
Yup. Forgot to remove it as you've tiped me before
Didn't remembered about it.. seesh!
Once the game is over, the king and the pawn go back in the same box.
Gothic-Angel
Op
Posts: 109 Joined: Mon Sep 23, 2002 9:46 pm
Post
by Gothic-Angel » Thu Dec 18, 2003 5:01 pm
How would I go about changing the ban mask to *!*ident@*partial host ?
I really appreciate the help I'v got it working and added a bit onto it with other modes and stuff its comong alone well works fine with the current ban mask would just like to change it up a bit.