mIRC Home    About    Download    Register    News    Help

Print Thread
#220102 05/04/10 02:57 PM
Joined: Feb 2003
Posts: 3,412
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,412
Hi again!

Have been a while since i scripted, and now i run in to a problem.
I have this code:
Code:
  if (%capsflood.punishment != Disabled) && ($me isop $chan) && ($proc) {
    var %p = $int($calc(($regex($1-,/[A-ZÄÖ]/g) / $len($1-)) * 100))
    hinc -m $+(warn,$cid,$chan) $nick
    if ($len($1-) > 3) && (%p > 60) && ($hget($+(warn,$cid,$chan),$nick)) { 
      if (%punish.caps == 1) && (!% [ $+ [ $nick ] ]) { msg $chan $nick Using CAPS is considered shouting, so turn off your CAPSLOCK. | set -u600 % [ $+ [ $nick ] ] 1 | return }
      if (%punish.capskb == 1) { ban $+(-ku,$calc(%temp.ban * 60)) $chan $nick %bf $eval(%caps.ban,2) }
      if (%punish.capsk == 1) && (% [ $+ [ $nick ] ] != 2) { kick $chan $nick $eval(%caps.kick,2) $kcs | inc % [ $+ [ $nick ] ] | return }
      hdel $+(warn,$cid,$chan) $nick
      unset % [ $+ [ $nick ] ]

And it working, but i want it to:

1: Warn
2: Kick
3: Ban

but i can't get it to first warn, then kick, and last ban.

Now it warn, then warn again, and after that it kick, any ideas on this? or can you point me in the right direction?

$proc return channels the script should be enabled in,

I left out the on *:text:*:#: { since i have 5 other protections in the same section.

Thnx in advance.

; EDIT

No one that have a idea?

Last edited by sparta; 05/04/10 07:46 PM.
Joined: Nov 2006
Posts: 1,552
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,552
The script increases hash values (hinc), but checks variables and not the hash...
You could set it like:

Code:
if (SCRIPT ENABLED) && (OP) && (OTHER REQUIRED CHECKS) {

  var %p = CAPS PERCENT CALCULATION
  if (%p > LIMIT) && (TEXTLEN > MINIMUM LEN) {

    hinc -muTIMEOUT CAPSTABLE <nick or mask>
    var %stage = $hget(CAPSTABLE,<nick or mask>)

    if (%stage = 1) { WARN }
    elseif (%stage = 2) { KICK }
    elseif (%stage > 2) {
      KICKBAN
      hdel CAPSTABLE <nick or mask>
    }
  }
}

Last edited by Horstl; 05/04/10 08:40 PM.
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
Originally Posted By: Horstl
if (%stage = 1) { WARN }
elseif (%stage = 2) { KICK }
elseif (%stage > 2) {
KICKBAN
hdel CAPSTABLE <nick or mask>
}
Using if, elseif and else will do just fine:
Code:
  if (%stage > 2) { KICKBAN | hdel timeout nick/host }
  elseif (%stage = 1) { WARN }
  else { KICK }

Joined: Nov 2006
Posts: 1,552
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,552
Now that's a difference whistle
I put the pseudo-code that way to be comprehensible, it's structure isn't tweaked for performance anyway.

Joined: Feb 2003
Posts: 3,412
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,412
I edited your code a bit, but it working now. Thnx for the help.


Link Copied to Clipboard