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.

Prob with proc in a bind kick

Help for those learning Tcl or writing their own scripts.
Post Reply
N
Nara
Halfop
Posts: 40
Joined: Sun Jul 23, 2006 11:12 pm

Prob with proc in a bind kick

Post by Nara »

Alright, I'm aware this code is very messy. Sorry. This script just won't work, I'm probably using the wrong things, please help me out. This is meant to ban anyone without a flag P using bans. Also, it has a clause for ChanServ bans They are issued with a reason like this: "(Nara) You're an idiot."

Code: Select all

bind kick - * kickuser

proc kickuser {nick host hand chan target reason} {
if {![string equal $nick "ChanServ"]} {
if {![matchattr $hand P] && ![string equal [finduser [lindex [split $host @] 1]] "*"]} {
newchanban "$chan" "*!*@[lindex [split $host @] 1]" "KickUser" "Kicking users on #chan is not permitted. Perm ban, PM Nara for removal" "0"
putserv "PRIVMSG Chanserv :#chan deluser $nick"
}
if {[string equal [finduser [lindex [split $host @] 1]] "*"]} {
newchanban "$chan" "*!*@[lindex [split $host @] 1]" "KickUser" "Kicking users on #chan is not permitted. Perm ban, PM Nara for removal" "0"
putserv "PRIVMSG Chanserv :#chan deluser $nick"
}
}
if {[string equal $nick "ChanServ"]} {
regexp {/((.*?/)} $reason match $reason2
}
if {[$reason2 onchan "#2g"]} {
if {![string equal [finduser [lindex [split $host @] 1]] "*"]} {
if {![matchattr [finduser [lindex [split $host @] 1]] P]} {
newchanban "$chan" "*!*@[lindex [split $host @] 1]" "KickUser" "Kicking users on #chan is not permitted. Perm ban, PM Nara for removal" "0"
putserv "PRIVMSG Chanserv :#chan deluser $nick"
}
}
}
if {![$reason2 onchan "#chan"]} {
newchanban "$chan" "*!*@$reason2.*.gamesurge" "KickUser" "Kicking users on #2g is not permitted. Perm ban, PM Nara for removal" "0"
putserv "PRIVMSG Chanserv :#2g deluser "/*$reason2"
}
}
Also, can you please tell me if this is done right:

Code: Select all

bind notc - * noticekick

proc noticekick {nick uhost handle text dest} {
if {[validchan $dest]} {
set dest [string tolower $dest]
if {[string equal $dest "#chan"] && ![matchattr $handle P]} {
newchanban "$dest" "*!*@[lindex [split $uhost @] 1]" "NoticeBan" "Noticing $dest is not permitted." "0"
putserv "PRIVMSG Chanserv :#chan deluser $nick"
}
}
}
Thank you,
Nara
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

First, apply indenting to make this script readable.
Secondly, give us the errors you encounter, you cannot expect us to to help you without knowing what exactly you did wrong.
Also, use elseif instead of a million if's.
Post Reply