Runaway-Script-Proof Protections

By nfield38 on May 30, 2006

The main problem with scripts--especially protection--is that some tend to take over the IRC client, and run themselves out of control, be it deopping the wrong people, or simply not stopping. This set of deop, kick, and ban protections are fool proof of this, as they require the user's input to activate! The protocol is as follows:

F4: Undo the action (reop/rejoin/unban).
Shift F4: Undo the action, and kick the responsible user.
Ctrl F4: Undo the action, and kickban the responsible user.

If there is no user input within a minute of the deop/kick/ban, then the protections disable themselves. Enjoy!

; Runaway-Script-Proof Protections, by Nick Field (nfield38).
; Feel free to use that as needed, but credit would be nice if you
; plan to redistribute this, etc. Questions or comments may be 
; directed to NField on DarkMyst IRC (irc.darkmyst.org). Enjoy!

; F4: Undo action.
; Shift F4: Undo action. Kick user.
; Ctrl F4: Undo action. Kickban user.

on *:ban:#:{
  if (($banmask iswm $address($me,5)) && ($me != $nick)) {
    .enable #r.ban
    set -u60 %ban.mask $banmask
    set -u60 %ban.chan $chan
    set -u60 %ban.nick $nick
    set -u60 %ban.address $address($nick,%btype)
    .timer 1 60 .disable #r.ban
    if ($active != $chan) echo 14 -at [!] You were banned ( $+ $banmask $+ ) from $chan by $nick [F4 to unban]
    else echo 14 -t $chan [!] [F4 to unban]
  }
}
on *:deop:#:{
  if (($me == $opnick) && ($me != $nick)) {
    .enable #r.deop
    set -u60 %deop.chan $chan
    set -u60 %deop.nick $nick
    set -u60 %deop.address $address($nick,%btype)
    .timer 1 60 .disable #r.deop
    if ($active != $chan) echo 14 -at [!] You were deopped on $chan by $nick [F4 to reop]
    else echo 14 -t $chan [!] [F4 to reop]
  }
}
on *:kick:#:{
  if (($me == $knick) && ($me != $nick)) {
    .enable #r.kick
    set -u60 %kick.chan $chan
    set -u60 %kick.nick $nick
    set -u60 %kick.address $address($nick,%btype)
    .timer 1 60 .disable #r.kick
    if ($active != $chan) echo 14 -at [!] You were kicked from $chan by $nick ( $+ $1- $+ ) [F4 to rejoin]
    else echo 14 -t $chan [!] [F4 to rejoin]
  }
}

#r.ban off
alias F4 {
  if ($me isop %ban.chan) ban -r %ban.chan %ban.mask
  else .msg ChanServ unban %ban.chan %ban.mask
  .disable #r.ban
  .unset %ban.*
}
alias sF4 {
  if ($me isop %ban.chan) {
    mode %ban.chan -ob %ban.nick %ban.mask
    kick %ban.chan %ban.nick Ban Protection
    .disable #r.ban
    .unset %ban.*
  }
  else {
    .msg ChanServ unban %ban.chan %ban.mask
    .enable #r1.ban
    .timer 1 60 .disable #r1.ban
    .timer 1 60 .unset %ban.*
  }
}
alias cF4 {
  if ($me isop %ban.chan) {
    mode %ban.chan -ob+b %ban.nick %ban.mask %ban.address
    kick %ban.chan %ban.nick Ban Protection
  }
  else {
    .msg ChanServ unban %ban.chan %ban.mask
    .enable #r2.ban
    .timer 1 60 .disable #r2.ban
    .timer 1 60 .unset %ban.*
  }
  .disable #r.ban
  .unset %ban.*
}
#r.ban end

#r1.ban off
on *:op:#:{
  if ($opnick == $me) && ($chan == [ [ %ban.chan ] ]) {
    mode $chan -o %ban.nick
    kick $chan %ban.nick Ban Protection
    unset %ban.*
    .disable #r1.ban
  }
}
#r1.ban end

#r2.ban off
on *:op:#:{
  if ($opnick == $me) && ($chan == [ [ %ban.chan ] ]) {
    mode $chan -o+b %ban.nick %ban.address
    kick $chan %ban.nick Deop Protection
    unset %ban.*
    .disable #r2.ban
  }
}
#r2.ban end

#r.deop off
alias F4 {
  .msg ChanServ op %deop.chan $me
  .disable #r.deop
  .unset %deop.*
}
alias sF4 {
  .msg ChanServ op %deop.chan $me
  .enable #r1.op
  .disable #r.deop
}
alias cF4 {
  .msg ChanServ op %deop.chan $me
  .enable #r2.op
  .disable #r.deop
}
#r.deop end

#r1.op off
on *:op:#:{
  if ($opnick == $me) && ($chan == [ [ %deop.chan ] ]) {
    mode $chan -o %deop.nick
    kick $chan %deop.nick Deop Protection
    unset %deop.*
    .disable #r1.op
  }
}
#r1.op end

#r2.op off
on *:op:#:{
  if ($opnick == $me) && ($chan == [ [ %deop.chan ] ]) {
    mode $chan -o+b %deop.nick %deop.address
    kick $chan %deop.nick Deop Protection
    unset %deop.*
    .disable #r2.op
  }
}
#r2.op end

#r.kick off
alias F4 {
  join %kick.chan
  unset %kick.*
  .disable #r.kick
}
alias sF4 {
  join %kick.chan
  .enable #r1.kick
  .timer 1 60 .disable #r2.kick
  .timer 1 60 .unset %kick.*
  .disable #r.kick
}
alias cF4 {
  join %kick.chan
  .enable #r2.kick
  .timer 1 60 .disable #r2.kick
  .timer 1 60 .unset %kick.*
  .disable #r.kick
}
#r.kick end

#r1.kick off
on *:op:#:{
  if ($opnick == $me) && ($chan == [ [ %kick.chan ] ]) {
    mode $chan -o %kick.nick
    kick $chan %kick.nick Kick Protection
    unset %kick.*
    .disable #r1.kick
  }
}
#r1.kick end

#r2.kick off
on *:op:#:{
  if ($opnick == $me) && ($chan == [ [ %kick.chan ] ]) {
    mode $chan -o+b %kick.nick %kick.address
    kick $chan %kick.nick Kick Protection
    unset %kick.*
    .disable #r2.kick
  }
}
#r2.kick end

Comments

Sign in to comment.
computermaineack   -  Jun 12, 2007

i want it so that i don\'t have to press F4, so that if i\'m away when i\'m deopped i\'ll be reopped automatically....how would i go about doing that?

 Respond  
Fresh4Life   -  Feb 04, 2007

Can Run it

 Respond  
nfield38   -  Jun 08, 2006

There were some code errors, but are now fixed. :>

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.