Tchatting.com Forums
mIRC :: SCRIPTING & HELP mIRC Scripting help, General help, Tips and Tricks!

User Name
Password
Reply
 
Thread Tools Display Modes
  #1  
Old 21-10-2005, 07:30 PM
Cult's Avatar
Cult Cult est déconnecté
Registered User
 
Join Date: Jan 2005
Location: Lebanon
Posts: 2,116
Cult is a jewel in the roughCult is a jewel in the roughCult is a jewel in the rough
Send a message via MSN to Cult
Caps Flood

PHP Code:
alias caps {
  
set -l %caps $regex(caps,$strip($1-),/[A-Z]/g)
  
set -l %norm $regex(caps,$strip($1-),/[^A-Z]/g)
  
set -l %total $len($strip($1-))
  if (
$prop == caps) { return %caps }
  elseif (
$prop == ncaps) { return %norm }
  else { return
$calc((%caps / %total) * 100) }
}
on *:text:*:#:{
  
if ($nick isop $chan) { halt }
  elseif { (
$caps($1-) > 50) && ($len($strip($1-)) >= 6)) {
      
ban $chan $nick
      kick $chan $nick Caps flood detected
. $caps($1-) $+ % in sentence are capitalized.
    }
  }
}
__________________

Last edited by Cult; 21-11-2005 at 07:31 PM.
Reply With Quote
  #2  
Old 15-11-2005, 10:51 AM
Cult's Avatar
Cult Cult est déconnecté
Registered User
 
Join Date: Jan 2005
Location: Lebanon
Posts: 2,116
Cult is a jewel in the roughCult is a jewel in the roughCult is a jewel in the rough
Send a message via MSN to Cult
Re: Caps Flood

On @*:TEXT:*:#: {
if ($nick !isop #) && ($len($1-) > 3) {
var %caps.percent = $calc($regex($1-,/[A-Z]/g)/$len($1-)*100)
if (%caps.percent > 60) {
ban -k # $nick 2 Since you will not listen, its best you leave coz you too loud in CAPS text.
}
}
}

I THINK THIS IS BETTER :p
__________________
Reply With Quote
  #3  
Old 07-02-2006, 11:17 AM
Cult's Avatar
Cult Cult est déconnecté
Registered User
 
Join Date: Jan 2005
Location: Lebanon
Posts: 2,116
Cult is a jewel in the roughCult is a jewel in the roughCult is a jewel in the rough
Send a message via MSN to Cult
Re: Caps Flood

Caps Kicker Using $regex Again, Working 100 % Id Someone Typed 40 % In Caps Letters.
***NOTICE: If You Are Using An Old Version Of miRc, Means Below 6.03, You Will Have To change this code:

Code:
ban -k $chan $nick Please do not overuse capital letters.
and it will be:

Code:
ban $chan $nick 2
kick $chan $nick Please Do Not OverUse Capital Letters.


Code:
on $@*:TEXT:/([A-Z])/g:#: { 
  if ($calc($regml(0) / $len($1-)) >= .40) && ($nick isreg $chan) && ($len($1-) > 4) { 
    ban -k $chan $nick Please Do Not OverUse Capital Letters. 
  } 
}
__________________
Reply With Quote
  #4  
Old 31-10-2006, 10:32 AM
Cult's Avatar
Cult Cult est déconnecté
Registered User
 
Join Date: Jan 2005
Location: Lebanon
Posts: 2,116
Cult is a jewel in the roughCult is a jewel in the roughCult is a jewel in the rough
Send a message via MSN to Cult
Re: Caps Flood

Code:
on @*:text:*:#: {
  var %c = 1, %u = 0, %l = 0
  while (%c <= $len($1-)) {
    if ($mid($1-,%c,1) isupper) {
      inc %u
    }
    if ($mid($1-,%c,1) islower) {
      inc %l
    }
    inc %c
  }
  if ($gettok($calc(%u / $len($1-) * 100),1,46) >= 70) {
    ban -k $chan $nick 2 Caps Lock Kicker! $gettok($calc(%u / $len($1-) * 100),1,46) $+ % caps.

  }
}
__________________
Reply With Quote
  #5  
Old 06-11-2006, 02:25 PM
ZAcK's Avatar
ZAcK ZAcK est déconnecté
Registered User
 
Join Date: Jan 2005
Location: Upper Saddle River, NJ USA
Posts: 54
ZAcK is on a distinguished road
Re: Caps Flood

Too many loops! I wouldn't go that way, count the characters instead.
Here is something I was working on some time ago; I don't understand a lot about $regex, but I mixed my code with yours on top and this is what I came up with:
Code:
On @*:TEXT:*:#: { 
  if ($nick isreg $chan) && ($len($1-) > 20) { 
    var %caps.percent = $calc($regex($1-,/[A-Z]/g)/$len($1-)*100) 
    if (%caps.percent > 50) ban -k $chan $nick 2  Execess CAPS $+( [ ,%,$ceil(%caps.percent),/%100 CAPS ] ) 
  } 
}
It will only re-act if the characters are more than 20 and the UPPER case characters are more than %50 of the total characters and of course it will only be triggered if you are an OP.
The kick message will look something like this:
Code:
* CAPS-FLOODER was kicked from #Channel by Some-OP ( Execess CAPS [ %51/%100 CAPS ]  )
You can even make it a simpler and faster code if you take out the percentage from the kick line:
Code:
On @*:TEXT:*:#: {
  if ($nick isreg $chan) && ($len($1-) > 20) && ($calc($regex($1-,/[A-Z]/g)/$len($1-)) > .5) {
  ban -k $chan $nick 2 Execess CAPS
  }
}
The other code you had, I think you are calling the $regex in the event line, not bad. I'm not sure which is faster though. I think since you are calling the $regex later on (using $regml) and only once, it doesn't make a difference; but again I might be wrong.

Got questions? I got answers ("I don't know" is an answer by the way!)
__________________
:: i have been since the dawn of time. i will be until the dusk of eternity ::
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Request] Channel Flood Protection AYEHAN mIRC :: SCRIPTING & HELP 12 07-04-2006 06:34 PM
flood pro Cult mIRC :: SCRIPTING & HELP 0 07-02-2006 11:11 AM
Caps Flood Cult mIRC :: SCRIPTING & HELP 0 21-10-2005 07:30 PM
Query Flood Protection Cult mIRC :: SCRIPTING & HELP 2 22-08-2005 12:17 PM
Action flood shiah mIRC :: SCRIPTING & HELP 0 25-03-2005 07:35 PM

All times are GMT. The time now is 11:03 PM.
Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
All data and information are copyright of DOTLeb Network