Help with a channel protection script.

Help for those learning Tcl or writing their own scripts.
Post Reply
H
Hamish
Voice
Posts: 25
Joined: Mon Mar 27, 2006 1:20 pm

Help with a channel protection script.

Post by Hamish »

Ok, I've got an autoop channel (everyone is autoop on join)...
Of course I don't want everyone banning each other and changing the topic all the time so I tried to write a script to stop that.
Here what I got so far:

Code: Select all

set Hamish "Hamish"

bind topc - "#hamish *" resetopc:topc
proc resetopc:topc { nick uhost handle channel topic } { 
  global Hamish botnick
  if { $nick == $Hamish } { }
  if { $nick == $botnick } { }
  else { puthelp "TOPIC #hamish :(original topic)"
  putlog "Reset topic changed by %nick"
  puthelp "PRIVMSG %NICK :Please don't try to change the topic on this channel..." }
}
  bind mode - * mode_proc_fix
  proc mode_proc_fix {nick uhost hand chan mc {victim ""}} {
    if {$victim != ""} {append mc " $victim"}
    mode_proc $nick $uhost $hand $chan $mc
  }
I've probably done it totally wrong... It is ment to reset the topic if someone other than me changes it... And remove all bans other than ones set by me.
If anyone can help I'd appreciate it, thanks!
Thanks, Hamish.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind join - "#hamish *" gettopic
bind topc - "#hamish *" resettopic

proc gettopic {nick uhost hand chan} {
 if {[isbotnick $nick]} {
  set ::currenttopic [topic $chan]
 }
}

proc resettopic {nick uhost hand chan topc} {
 global currenttopic
 if {[isbotnick $nick] || [string equal -nocase Hamish $nick]} {
  set currenttopic $topc
 } {
  putserv "topic $chan :$currenttopic"
  putlog "Reset topic changed by $nick"
  puthelp "privmsg $nick :Please don't try to change the topic on this channel..."
 }
}
H
Hamish
Voice
Posts: 25
Joined: Mon Mar 27, 2006 1:20 pm

Post by Hamish »

Ah yeah! Works perfectly thanks!
Now I'm gonna try a ban reset-er lol.
Thanks, Hamish.
Post Reply