Many of us done error in creating repeat kick script. We have to remember that TIME is our master. Instead using to many if...else statement, we can directly use inc -uN %vars. This type of variables will be automatically removed after N seconds. Here is HOW-TO make the repeat kicker quite efficient, small and fast.
First, let us create our limiters variables:
alias SetRepeatFlag {
SET %rep.lim 3
SET %rep.t.lim 20
SET %banlevel 3
}
This alias is purposely to set our variables %rep.lim, %rep.t.lim and %banlevel.
%rep.lim limits the same text to scroll for 3 times.
%rep.t.lim is the duration for the detection of the repeating text.
%banlevel is our ban level type
Let us show the coding of the script:
ON ^@*:TEXT:*:#:{
IF ($nick !isreg $chan) { goto end }
; First, we have to determine the type of user that type the text.
; We usually skip if the nick is an operator, voice operator and half operator.
IF (%lockusr- [ $+ [ $chan ] $+ [ $nick ] ]) { haltdef | goto end }
; We check a variable call %lockusr- [ $+ [ $chan ] $+ [ $nick ] ] whether it available or not.
; It will halt the default text and go to :end skipping out the next remote.
INC -u [ $+ [ %rep.t.lim ] ] %rep- [ $+ [ $nick ] $+ . $+ [ $chan ] $+ . $+ [ $len($strip($1-) ] $+ . $+ [ $hash($strip($1-),32) ] ] 1
; The main variable %rep- [ $+ [ $nick ] $+ . $+ [ $chan ] $+ . $+ [ $len($strip($1-) ] $+ . $+ [ $hash($strip($1-),32) ] ]
; is automatically created and increased if the nick types the same text.
; Look at the last mIRC identifier $hash. $hash is purposely to hashing the text with a bit and here i use 32, so the
; number we got quite big. Try //echo -a $hash(hello world,32) and see the result.
IF (%rep- [ $+ [ $nick ] $+ . $+ [ $chan ] $+ . $+ [ $len($strip($1-) ] $+ . $+ [ $hash($strip($1-),32) ] ] == %rep.lim) {
; Next code is the if statement. This statement is to check whether our var
; %rep- [ $+ [ $nick ] $+ . $+ [ $chan ] $+ . $+ [ $len($strip($1-) ] $+ . $+ [ $hash($strip($1-),32) ] ]
; has reached our limit, %rep.lim.
IF ($nick ison $chan) { .raw -q kick $chan :Repeating Over Than %rep.lim Times }
mode $chan +b $mask($fulladdress,%banlevel)
; If it does, then the next codes will be run. The nick will be kicked and banned.
.SET -u10 %lockusr- [ $+ [ $chan ] $+ [ $nick ] ] 1
; After that, it creates a variable %lockusr- [ $+ [ $chan ] $+ [ $nick ] ] and sets it to 1.
; This variable act like /ignore but specifically for the channel
}
ELSE { goto end }
:end
; After all, if you still connected to the server,
; the variables we created will be gone according to the timer we have set.
}