Skip to content

Instantly share code, notes, and snippets.

@westor7
Last active November 28, 2021 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westor7/7f6425e9aec688785b18e3b6f4b0685a to your computer and use it in GitHub Desktop.
Save westor7/7f6425e9aec688785b18e3b6f4b0685a to your computer and use it in GitHub Desktop.
Identical Clones Kick/Ban for Cappuccino (Release_)
ON ^!*:JOIN:#: {
if (!$nick($chan,$me,@&~%)) && (o !isin $usermode) { return }
haltdef
set -l %hash_1 JCLONES_ $+ $chan
set -l %hash_2 JCLONESNICKS_ $+ $chan
set -l %nick_5chars $left($nick,5)
hinc -mu3 %hash_1 %nick_5chars 1
hadd -m %hash_2 $nick $ial($nick).host
set -l %nick_total $hget(%hash_1,%nick_5chars)
if (%nick_total > 1) {
if (!$timer([JCLONES_ [ $+ [ $chan ] $+ ] _LOCK])) {
;echo $chan -g 01,08 ( cloned nicks Flood ) !!!!! Channel Locked !!!!! 
.raw -q MODE $chan +MRb $+(%nick_5chars,*!*@*)
.timer[JCLONES_ $+ $chan $+ _LOCK] 1 30 mode $unsafe($chan) -MR
}
set -l %t $hget(%hash_2,0).item
if (%t) {
set -l %i 1
while (%i <= %t) {
set -l %n $hget(%hash_2,%i).item
set -l %h $hget(%hash_2,%n)
if (%n) && (%h) && (* $+ %nick_5chars $+ * iswm %n) {
set -l %total_nicks $addtok(%total_nicks,%n,44)
set -l %total_hosts $addtok(%total_hosts,$+(*@,%h),32)
}
inc %i
}
if (%total_hosts) { pushmodex $chan $+(+,$str(b,$numtok(%total_hosts,32))) %total_hosts }
if (%total_nicks) { .raw -q KICK $chan %total_nicks !!! Indentical nicks !!! }
}
if ($hget(%hash_1)) { hfree $v1 }
if ($hget(%hash_2)) { hfree $v1 }
}
}
; Pushmode X - by entropy & Talon 2019 --> https://mircscripts.net/TaMnp
; Usage: /pushmodex [-tN] # [modes] [nicks/hosts]
; Example: /pushmodex #channel +bbbbbb host1 host2 host3 host4 host5 host6
; If "-tN" is specified, sets a timer in milliseconds eg: /pushmode -t2000... (for 2 secs)
alias -l pushmodex {
if (-t* iswm $1) { var %time = $mid($1,3) , %count = 1 | tokenize 32 $2- }
else { var %time = 0 , %count = 0 }
var %modespl = $modespl , %chan = $1 , %modes = $2 , %parms = $3- , %x = 1 , %y = $len(%modes) , %lwhich = + , %which = + , %a , %b
tokenize 44 $chanmodes
var %t1 = $1 , %t2 = $nickmode $+ $2 , %t3 = $3 , %t4 = $4
tokenize 32 %parms
while (%x <= %y) {
var %t = $mid(%modes,%x,1)
if (%t isin +-) { var %lwhich = %which , %which = %t }
else {
if (%t isincs $gettok(%t1 %t2 %t3, 1- $pos(.-+, %which),32)) {
var %b = %b $1
tokenize 32 $2-
}
var %a = $+(%a,$iif(!%a || %lwhich != %which,%which),%t) , %lwhich = %which
if ($len($remove(%a,+,-)) = %modespl) {
if (!%time) { mode %chan %a %b }
else { .timer -m 1 $calc(%time * %count) mode $unsafe(%chan) %a %b }
var %a = "" , %b = "", %count = %count + 1
}
}
inc %x
}
if (%a) {
if (!%time) { mode %chan %a %b }
else { .timer -m 1 $calc(%time * %count) mode $unsafe(%chan) %a %b }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment