Channel Protection for QuakeNET

By Dicaste on Jun 27, 2011

This bots uses nick's auth. If she/he want to speak in channel. She/He must be logged in account system. You can create an account one time with your auth. If she/he banned from channel they cant join the channel so BOOM BOOM :D

;;;;;;;;;; SLEEP ALIAS ;;;;;;;;;;
;; Syntax: /sleep N
;; Causes a script to 'sleep' N miliseconds. During this time
;; server and user raws are processed and events pass.
alias -l sleep {
  ;; when called as an identifier or the number of miliseconds
  ;; to sleep is 0, return
  if ($isid) || ($0 != 1) || ($1 !isnum) || ($1 < 1) !return

  ;; otherwise set a unique filename to a var, write the remote script to
  ;; that file and execute it using COM objects.
  !var %f = $ticks $+ .wsf
  !write %f <job id="js"><script language="jscript">WScript.Sleep( $+ $1 $+ );</script></job>
  !.comopen %f WScript.Shell
  if (!$comerr) .comclose %f $com(%f,Run,3,bstr,%f,uint,0,bool,true)
  !.remove %f
}

;;;;;;;;;; QAUTH ALIAS ;;;;;;;;;;
;; Syntax: $qauth(nick)
;; Returns the qauth of a user or $null if the user is not authed -- QuakeNet only
alias qauth {
  ;; check if used as identifier and if the network used on is quakenet
  if (!$isid) || (*.??.quakenet.org !iswm $server) !return

  ;; check if the Q auth could be extracted from the host
  if ($ial($1).host) if ($regex($ial($1).host,(.+?)\.users\.quakenet\.org)) !return $regml(1)

  ;; check if the Q auth could be extracted from the ialmark
  if ($ial($1).mark) !return $v1

  ;; set a global var and send out a who to get the users Q auth
  ;; the while loop waits for the server response
  !set %getQauth [ $+ [ $1 ] ] $crlf
  !.who $1 n%nat,101
  !var %i = 10
  while (%i) && (%getQauth [ $+ [ $1 ] ] == $crlf) {  
    sleep 1  
    !dec %i
  }

  ;; set local return var so the global var can be removed
  !var %return = $iif(%getQauth [ $+ [ $1 ] ] == $crlf,$null,$v1)
  !unset %getQauth [ $+ [ $1 ] ]

  ;; add q auth to IAL mark
  if (%return != -) !.ialmark $1 $v1

  !return $iif(%return != -,$v1,$null)
}

;;;;;;;;;; RAW 354 - SPECIAL WHO REPLY ;;;;;;;;;;
raw 354:& 101 & *:{
  if (%getQauth [ $+ [ $3 ] ]) {
    !set %getQauth [ $+ [ $3 ] ] $iif($4,$v1,-)
    !haltdef
  }
}

;;;;;;;;;; RAW 315 - END OF /WHO LIST ;;;;;;;;;;
raw 315:*:{
  ;; see whether a Q auth was requested and if so, halt the default output
  if (%getQauth [ $+ [ $2 ] ]) !haltdef
}

alias Settings {
  set %FolderName ProtectionScript
  mkdir %FolderName
  writeini $+(%FolderName,/Script) Settings Channel #[CHANNEL NAME]
  .join $readini($+(%FolderName,/Script),Settings,Channel)
  writeini $+(%FolderName,/Script) Settings ProtectionStatus ON
  .mode $readini($+(%FolderName,/Script),Settings,Channel) -r
  .mode $readini($+(%FolderName,/Script),Settings,Channel) +m
  var %i 1
  var %x $ibl($readini($+(%FolderName,/Script),Settings,Channel),0)
  var %Type $+(-,$str(b,%x))
  while ( %i <= %x ) {
    var %Bans %Bans $ibl($readini($+(%FolderName,/Script),Settings,Channel),%i)
    inc %i
  }
  mode $readini($+(%FolderName,/Script),Settings,Channel) %Type %Bans
  msg $readini($+(%FolderName,/Script),Settings,Channel) 04* Settings are changed 03CORRECTLY 04*
}

on ^*:JOIN:$($readini($+(%FolderName,/Script),Settings,Channel)):{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == ON ) {
    if ( $qauth( $Nick ) == $null ) {
      notice $Nick 04* You are not 04AUTHED 04*
      notice $Nick 04* Syntax: /msg Q HELLO [EMAIL ADDRESS] [EMAIL ADDRESS] 04*
    }
    else {
      if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Banned) == YES ) {
        mode $chan +b $qauth( $BNick )
        kick $Nick 04* You are 04BANNED 04*
        notice $Nick 04* You are 04BANNED from $+(07,$readini($+(%FolderName,/Script),Settings,Channel),) 04*
      }
      else {
        if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Registered) == $null ) {
          notice $Nick 04* Please 07REGISTER 04*
          notice $Nick 04* Syntax: /msg $me !register [USERNAME] [PASSWORD] 04*
        }
        else {
          if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Logged) == NO ) {
            notice $Nick 04* Please 07LOGIN 04*
            notice $Nick 04* Syntax: /msg $me !login [USERNAME] [PASSWORD] 04*
          }
          else {
            if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Registered) == YES ) && ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Logged) == YES ) && ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Banned) == NO ) {
              mode $chan +v $Nick
              notice $Nick 04* 03WELCOME to $+(07,$readini($+(%FolderName,/Script),Settings,Channel),) 04*
            }
          }
        }
      }
    }
  }
}

on ^*:TEXT:!register*:?:{
  if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Registered) != $null ) {
    notice $Nick 04* You are 04REGISTERED already 04*
  }
  else {
    var %Username $strip($2)
    if ( %Username == $null ) {
      notice $Nick 04* Please write an 07USERNAME 04*
      notice $Nick 04* Syntax: /msg $me !register [USERNAME] [PASSWORD] 04*
    }
    else {
      var %Password $strip($3)
      if ( %Password == $null ) {
        notice $Nick 04* Please write a 07PASSWORD 04*
        notice $Nick 04* Syntax: /msg $me !register [USERNAME] [PASSWORD] 04*
      }
      else {
        writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Registered YES
        writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Logged NO
        writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Username %Username
        writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Password %Password
        writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Banned NO
        notice $Nick 04* You are registered 03SUCCESFULLY 04*
        notice $Nick 04* Please 07LOGIN 04*
        notice $Nick 04* Syntax: /msg $me !login [USERNAME] [PASSWORD] 04*
      }
    }
  }
}

on ^*:TEXT:!login*:?:{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == NO ) {
    notice $Nick 04* Protection system is temporary 04OFF 04*
  }
  else {
    if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Registered) == NO ) {
      notice $Nick 04* You are not 04REGISTERED 04*
    }
    else {
      if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Logged) == YES ) {
        notice $Nick 04* You are 04LOGGED already 04*
      }
      else {
        var %Username $strip($2)
        if ( %Username == $null ) {
          notice $Nick 04* Please write an 07USERNAME 04*
          notice $Nick 04* Syntax: /msg $me !login [USERNAME] [PASSWORD] 04*
        }
        else {
          var %Password $strip($3)
          if ( %Password == $null ) {
            notice $Nick 04* Please write a 07PASSWORD 04*
            notice $Nick 04* Syntax: /msg $me !login [USERNAME] [PASSWORD] 04*
          }
          else {
            if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Username) != %Username ) && ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Password) == %Password ) {
              notice $Nick 04* Username is 04WRONG 04*
            }
            else {
              if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Username) == %Username ) && ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Password) != %Password ) {
                notice $Nick 04* Password is 04WRONG 04*
              }
              else {
                if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Username) != %Username ) && ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Password) != %Password ) {
                  notice $Nick 04* Username and Password is 04WRONG 04*
                }
                else {
                  if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Username) == %Username ) && ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Password) == %Password ) {
                    writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Logged YES
                    notice $Nick 04* You are logged 03SUCCESFULLY 04*
                    msg $readini($+(%FolderName,/Script),Settings,Channel) 04* Welcome to $+(07,$readini($+(%FolderName,/Script),Settings,Channel),) , $+($Nick,!) 04*
                    mode $readini($+(%FolderName,/Script),Settings,Channel) +v $Nick
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

on ^*:TEXT:!forgot*:?:{
  if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Registered) == $null ) {
    notice $Nick 04* You are not 04REGISTERED 04*
  }
  else {
    if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Logged) == YES ) {
      notice $Nick 04* You are 04LOGGED already 04*
    }
    else {
      notice $Nick 04* Your  07USERNAME is  $+(03,$readini($+(%FolderName,/Accounts),$qauth( $Nick ),Username),) 04*
      notice $Nick 04* Your  07PASSWORD is  $+(03,$readini($+(%FolderName,/Accounts),$qauth( $Nick ),Password),) 04*
      notice $Nick 04* Syntax: /msg $me !login [USERNAME] [PASSWORD] 04*
    }
  }
}

on ^*:BAN:$($readini($+(%FolderName,/Script),Settings,Channel)):{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == ON ) {
    if ( $BNick !isop $chan ) {
      writeini $+(%FolderName,/Accounts) $qauth( $BNick ) Banned YES
      mode $chan +b $qauth( $BNick )
      kick $BNick 04* You are 04BANNED 04*
      notice $BNick 04* You are 04BANNED from $+(07,$readini($+(%FolderName,/Script),Settings,Channel),) 04*
    }
  }
}

on ^*:KICK:$($readini($+(%FolderName,/Script),Settings,Channel)):{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == ON ) {
    if ( $readini($+(%FolderName,/Accounts),$qauth( $KNick ),Logged) == YES ) {
      writeini $+(%FolderName,/Accounts) $qauth( $KNick ) Logged NO
    }
  }
}

on ^*:PART:$($readini($+(%FolderName,/Script),Settings,Channel)):{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == ON ) {
    if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Logged) == YES ) {
      writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Logged NO
    }
  }
}

on ^*:QUIT:{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == ON ) {
    if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Logged) == YES ) {
      writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Logged NO
    }
  }
}

on ^*:DISCONNECT:{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == ON ) {
    if ( $readini($+(%FolderName,/Accounts),$qauth( $Nick ),Logged) == YES ) {
      writeini $+(%FolderName,/Accounts) $qauth( $Nick ) Logged NO
    }
  }
}

on ^*:OP:$($readini($+(%FolderName,/Script),Settings,Channel)):{
  if ( $readini($+(%FolderName,/Script),Settings,ProtectionStatus) == ON ) {
    if ( $qauth( $OPNick ) == $null ) {
      notice $OPNick 04* You are not 04AUTHED 04*
      notice $OPNick 04* Syntax: /msg Q HELLO [EMAIL ADDRESS] [EMAIL ADDRESS] 04*
      mode $chan -o $OPNick
      mode $chan -v $OPNick
    }
    else {
      if ( $readini($+(%FolderName,/Accounts),$qauth( $OPNick ),Registered) == NO ) {
        notice $Nick 04* Please 07REGISTER 04*
        notice $Nick 04* Syntax: /msg $me !register [USERNAME] [PASSWORD] 04*
        mode $chan -o $OPNick
        mode $chan -v $OPNick
      }
    }
  }
}

Comments

Sign in to comment.
fraguk   -  Jun 28, 2011

Thanks sorted :) the script works nice now, and i like it :)

 Respond  
Dicaste   -  Jun 28, 2011

Hmm my fault :D

"writeini $+(%FolderName,/Script) Settings Channel #[CHANNEL NAME]" Write your channel here example
writeini $+(%FolderName,/Script) Settings Channel #mIRC

and then write "/settings" and script is running :D

 Respond  
fraguk   -  Jun 28, 2011

So how do i trun this script on? i have loaded it , and nothing is happening ..

 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.