mIRC Homepage
Posted By: BlackWidow Can someone please help - 04/07/06 01:35 AM
Hi

I am trying to recode this coding so that instead of it just banning someone it warns them first, then kicks , then bans ..
I tried posting this earlier but it did not seem to be get posted for some reason .. anyway the help would be much appreciated.. thanks ..

alias allowedcaps { return 70 }
alias max.controlcodes { return 15 }
alias max.marks { return 10 }

on @*:TEXT:*:#: {
if ($nick !isop #) {
if (%r. [ $+ [ $nick ] $+ . $+ [ $chan ] ] == $null) {
set -u60 %r. [ $+ [ $nick ] $+ . $+ [ $chan ] ] 1
set -u60 %r.text. [ $+ [ $nick ] $+ . $+ [ $chan ] ] $1-
return
}
var %rps = %r. [ $+ [ $nick ] $+ . $+ [ $chan ] ]
var %rpt = %r.text. [ $+ [ $nick ] $+ . $+ [ $chan ] ]
if (%rpt == $1-) {
inc %r. [ $+ [ $nick ] $+ . $+ [ $chan ] ]
if (%rps > 2) {
ban -u300 # $nick 4
kick # $nick You repeated %rps times, slow down! - 5 min ban
}
}
}
if ($len($1-) < 10) { return }
var %caps.letters = $calc($len($1-) + 1 - $len($removecs(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)))
var %caps = $calc($len($1-) - $len($removecs($1-,($1-),A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)))
var %caps.percent = $round($calc(%caps / %caps.letters * 100),0)
if ((%caps.percent > $allowedcaps) && ($nick !isop #)) {
ban # $nick 2
kick # $nick Caps Allowed: $allowedcaps $+ $chr(37) Caps Used: %caps.percent $+ $chr(37)
}
if ($nick !isop # && $len($1-) > 300) {
ban # $nick 2
kick # $nick Excess text!
}
var %c.c $calc($count($1-,$chr(3)) + $count($1-,$chr(2)) + $count($1-,$chr(22)) + $count($1-,$chr(31)))
if (%c.c > 15 && $nick isreg #) {
ban # $nick 2
kick # $nick Control Codes Allowed: $max.controlcodes / Control Codes Used: %c.c
}
var %mark.codes = $calc($count($1-,$chr(33)) + $count($1-,$chr(63)))
if ((%mark.codes > $max.marks) && ($nick isreg #)) {
ban # $nick 2
kick # $nick !!!/??? Allowed: $max.marks !!!/??? Used: %mark.codes
}
}
Posted By: RusselB Re: Can someone please help - 04/07/06 01:53 AM
First off, next time you post code in the forum, please remember to use the Code Tags.
Secondly, you have a nice script there, and I'm not sure how much of it you actually wrote, but here's your script again with the sections that I changed to allow for warning & kick before ban highlighted in red.

That should give you an idea as to how to handle the same type of thing in the areas that I haven't done.
Code:
 alias allowedcaps { return 70 }
alias max.controlcodes { return 15 }
alias max.marks { return 10 }

on @*:TEXT:*:#: {
  if ($nick !isop #) {
    if !$+(%r.,$nick,.,$chan) {
      set -u60 $+(%r.,$nick,.,$chan) 1
      set -u60 $+(%r.text,$nick,.,$chan) $1-
      return
    }
    var %rps = $($+(%r.,$nick,.,$chan),2)
    var %rpt = $($+(%r.text,$nick,.,$chan),2)
    if (%rpt == $1-) {
 [color:red]       if (%rps == 2) {
        .notice $nick You repeated %rps times, slow down
      }
      elseif (%rps == 3) {
        kick # $nick You repeated %rps times, slow down
      }
      elseif (%rps &gt; 3) {
        ban -ku300 # $nick 4 You repeated %rps times, slow down! - 5 min ban
      }
 [/color] 
      inc $+(%r.,$nick,.,$chan)
    }
  }
  if ($len($1-) &lt; 10) { return }
  var %caps.letters = $calc($len($1-) + 1 - $len($removecs(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)))
  var %caps = $calc($len($1-) - $len($removecs($1-,($1-),A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)))
  var %caps.percent = $round($calc(%caps / %caps.letters * 100),0)
  if ((%caps.percent &gt; $allowedcaps) &amp;&amp; ($nick !isop #)) {
    ban -k # $nick 2 Caps Allowed: $allowedcaps $+ $chr(37) Caps Used: %caps.percent $+ $chr(37)
  }
  if (($nick !isop #) &amp;&amp; ($len($1-) &gt; 300)) {
    ban -k # $nick 2 Excess text!
  }
  var %c.c $calc($count($1-,$chr(3)) + $count($1-,$chr(2)) + $count($1-,$chr(22)) + $count($1-,$chr(31)))
  if (%c.c &gt; 15 &amp;&amp; $nick isreg #) {
    ban -k # $nick 2 Control Codes Allowed: $max.controlcodes / Control Codes Used: %c.c
  }
  var %mark.codes = $calc($count($1-,$chr(33)) + $count($1-,$chr(63)))
  if ((%mark.codes &gt; $max.marks) &amp;&amp; ($nick isreg #)) {
    ban -k # $nick 2 !!!/??? Allowed: $max.marks !!!/??? Used: %mark.codes
  }
} 
 


You'll probably notice that I changed the format of some of your variables. These changes do not affect how the variables work, I simply find them easier to read.
© mIRC Discussion Forums