On Protect/DeProtect Event

By Relinsquish on Oct 18, 2004

This snippet allows you to detect +a and -a channel mode events perfectly. It will count the number of times you have been protected/deprotected, and also give a "message" to the channel on that event. This follows the same format as the On Voice/Help/Op/Owner events. This snippet can be easily configured to detect other modes. If you don't know how, just contact me on IRC or Email.

On *:RAWMODE:#: {
  If ($Istokcs($2-,$Me,32) == $True) && (a isincs $1) {
    var %a = 1, %b = 1
    While (%a <= $Len($1)) {

      ; Sets %c for the next character
      var %c = $Mid($1,%a,1)

      ; Checks if the character is + or -
      If (%c == +) { var %d = 1 }
      Elseif (%c == -) { unset %d }

      ; Checks if the character displays a word in the 2nd token onwards (eg. +a Relinsquish)
      Elseif (%c !isincs cimnprstzACGMKNOQRSTVu) && ((%c !=== l) || ((%c === l) && (%d))) {

        ; Checks if the character is "a" (case sensitive) and the matching token is your nickname
        If (%c === a) && ($Gettok($2-,%b,32) == $Me) {
          ; Checks if the character is being set
          If (%d) {
            inc %ProtectCount
            msg # Thanks for the Protect $Nick $+ . I have been Protected %ProtectCount times.
          }

          ; Checks if the character is being unset
          Else {
            inc %DeProtectCount
            msg # Where did my Protect go $Nick $+ ? I have been DeProtected %DeProtectCount times.
          }

        }
        inc %b
      }
      inc %a
    }
  }
}

Comments

Sign in to comment.
Relinsquish   -  Oct 19, 2004

Good idea... makes update o_O

 Respond  
Sigh_   -  Oct 19, 2004

Good idea, but it would be more accurate to check each mode set against $chanmodes which returns the channel modes supported by the network. The first 3 comma delimited tokens are modes which take a parameter

 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.