Do you want this to go with on whats in the bots userfile? like use there handle as there nickname. And if they use that handle as the nickname and there hostmask dosen't match, It bans them? That sort of thing. I have seen a script that dose something like this, thou so far i've been unable to find it.
Well, just wanna to get those +o +v +f nick to be protected and not to be clone by others.
Example : One of the OP nick is @moon
and there is a new user enter with the nick moon_456
Can there be a script to scan for those onjoin and /nick change into a protected nick as above with a warn and will kb !*moon_456*@* within a period of time which user refuse to change.
*moon_456 enter #
<bot>Hey moon_456 , your nick is smiliar to an recognise OP in this channel. If u are the owner of the nick Pls identify through the nickserv or /nick <newnick> to change or i got to remove you.
**<bot>Kick moon_456 has been kick out from the channel ( You have been warnned. Pls /nick <newnick> and rejoin )
*** <bot> set ban !*moon_456*@*
Thanks. do you have some way of checking that the nickname is registered or not? like a raw numeric from the irc server in the /whois out put. Other wise its probably going to kick/ban them unless they change there nickname or leave the channel.
##
# chkopc.tcl
##
# Number of seconds before the bot will kick and ban the nickname that matches an ops?
set chkopc_time "120"
# Warning message to post to the nickname in the channel, that matches an ops nickname?
set chkopc_warnmsg ""
# Same as above. Only this will be used as the kick reason.
set chkopc_kickmsg ""
#Note: Please remenber to escape 'special chars' in the warnings and kick messages.
proc join:chkopc {nick host handle channel} {
global botnick chkopc_warnmsg chkopc_kickmsg chkopc_time
if {$nick == $botnick} {return}
if {[validuser [nick2hand $nick]] && [matchattr [nick2hand $nick] +fov|+fov $channel]} {return}
if {![validuser [nick2hand $nick]] || ![matchattr [nick2hand $nick] +fov|+fov $channel]} {
foreach target [chanlist $channel] {
if {[validuser [nick2hand $target]] && [matchattr [nick2hand $target] +fov|+fov $channel] && [onchan $target $channel]} {
if {[string match -nocase "*$target*" "$nick"]} {
puthelp "PRIVMSG $channel :$nick, $chkopc_warnmsg"
utimer $chkopc_time "putserv {KICK $channel $nick $chkopc_kickmsg}"
utimer $chkopc_time "putserv {MODE $channel +b $nick!*@*}"
return
}
}
}; return
}
}
proc nick:chkopc {nick host handle channel newnick} {
global botnick chkopc_warnmsg chkopc_kickmsg chkopc_time
if {$nick == $botnick} {return}
if {[validuser [nick2hand $nick]] && [matchattr [nick2hand $nick] +fov|+fov $channel]} {return}
if {![validuser [nick2hand $nick]] || ![matchattr [nick2hand $nick] +fov|+fov $channel]} {
foreach target [chanlist $channel] {
if {[validuser [nick2hand $target]] && [matchattr [nick2hand $target] +fov|+fov $channel] && [onchan $target $channel]} {
if {[string match -nocase "*$target*" "$nick"] && [string match -nocase "*$target*" "$newnick"]} {
putquick "KICK $channel $newnick $chkopc_kickmsg"
putquick "MODE $channel +bb $newnick!*@* $nick!*@*"
foreach ut [utimers] {
if {[string match "**$nick**" [join $ut]]} {
killutimer [lrange $ut end end]
}
}; return
}
if {[string match -nocase "*$target*" "$newnick"]} {
puthelp "PRIVMSG $channel :$newnick, $chkopc_warnmsg"
utimer $chkopc_time "putserv {KICK $channel $newnick $chkopc_kickmsg}"
utimer $chkopc_time "putserv {MODE $channel +b $newnick!*@*}"
return
}
if {[string match -nocase "*$target*" "$nick"]} {
foreach ut [utimers] {
if {[string match "**$nick**" [join $ut]]} {
killutimer [lrange $ut end end]
}
}; return
}
}
}; return
}
}
proc part:chkopc {nick host handle channel {msg ""}} {
global botnick
if {$nick == $botnick} {return}
if {[validuser [nick2hand $nick]] && [matchattr [nick2hand $nick] +fov|+fov $channel]} {return}
if {![validuser $handle] || ![matchattr $handle +fov|fov $channel]} {
foreach target [chanlist $channel] {
if {[validuser [nick2hand $target]] && [matchattr [nick2hand $target] +fov|+fov $channel] && [onchan $target $channel]} {
if {[string match -nocase "*$target*" "$nick"]} {
foreach ut [utimers] {
if {[string match "**$nick**" [join $ut]]} {
killutimer [lrange $ut end end]
}
}
}
}
}; return
}
}
bind join - "* *" join:chkopc
bind nick - "* *" nick:chkopc
bind part - "* *" part:chkopc
putlog "loaded chkopc.tcl --"
return
Should hopefully do the trick. Dont worrie about it warning then kicking and banning the nickname. It will only ban them after the set time if they dont change there nickname or part the channel.
[update #1] Added checks for and settings for netsplits.
[update #2] Fixed mising flag check on join proc.
[update #3] Done some testing. fixed alot of errors. removed some code.
Last edited by TCL_no_TK on Sat Dec 01, 2007 4:56 am, edited 2 times in total.
I m sorry. I have loaded the script and restart the bot. It seen nothing happen while i get an OP nick to enter the channel. Even tat goes for a /nick OPnick change.
Check that they aren't recognized as a bot user and have the +fov flag globally or on the channel. Updated it just now to fix a missing flag check on the join proc. sorry about that, didn't see it when i was doing it.
They would need a differant hostmask (*!ident@*.host) from the one in the bots userfile, the user record for the nickname (aka. the op nickname). The only way it would do anything to someone that has been added to the bot is if they didn't have the flags +f +o or +v global or on the channel. They would just keep getting warned and ban after the set time. If the script didn't exempt the flags (+f +o or +v). Check the .channel <#name> output from DCC/Chat on the bots partyline it should show you all the users and there flags on the given channel <#name>. P.S want me to remove the global flag exempt incase you have some kinda of login or id system that gives them the flags for that channel, while they still have there global flag or flag(s)?
I'll add it one of ma bots and do some testing on it then. It shouldn't tak longer than a day or two. Sorry to make ya wait.
Edit: I've rushed it and done some tested fixed alot of things. And it should work fine now, the code could probably do with alot of improving. And i've also removed the split code and stuff, since i wasn't able to test it.
Should work now, if ya do have any problems with it. Please make an other post and i'll look at it again. Be sure to let me know how it gose, cos am started to like this script