Welcome
The Clone Kicker script probably requires the most scripting out of the main protection type scripts. The basic concepts to a clone kicker is that when someone joins a channel, they have a host (Which we can get using $wildsite or $gettok($wildsite,2,64)) which is unique every computer (Unless the person is connecting through a Proxy, BNC or some other service sharing device). mIRC has the $ialchan identifier. What this lets us do is count the number of people in a chanenl with the same host:
on @*:JOIN:#:{
if ($ial == $false) .ial on
if ($chan(#).ial == $false) { who # | return }
var %total = $ialchan($wildsite,#,0)
; %total is set to the number of people on the channel using $wildsite
if (%total > 1) {
;If there is MORE than one person using $wildsite then we start kicking...
ban -u60 # $nick 2
;Notice how I put the ban command here and used bantype 2 ($wildsite).
;Why? So I only have to place one ban yet it bans every clone.
var %i = 0
while (%i < %total) {
;This while loop loops through all the nicks using $wildsite
inc %i
var %nick = $ialchan($wildsite,#,%i).nick
; %nick is set to the current nickname
var %all.nicks = $addtok(%all.nicks,%nick,32)
; %all.nicks is set to every nick from $wildsite
if (%nick !isop #) {
kick # %nick Clone flood detected from $wildsite ( $+ %total users)
}
}
echo 4 -a *** Clone flood detected from $wildsite $+ : %all.nicks
}
}
For this script to work properly you need your IAL (Internal Address List) on /ial on and you need to /who #channel to every channel you join. You can automate the /who part:
on me:*:JOIN:#: .timer 1 3 check.ial $chan alias -l check.ial if ($chan($1).ial == $false) who $1
This sets a timer that wil in 3 seconds check to see if the IAL for the channel is full. Why 3 seconds? Well there could be chance that another script also tried to update the IAL when you joined - there is no reason to do it twice.
If you wanted to improve the performance of the clone kicker and you are only going to use the script on a DALnet server, DALnet supports kicking upto 4 nicks in one kick line /kick # nick1,nick2,nick3,nick4 message. So if you knew how to use tokens you could still create %all.nicks but at the end use tokens to get the first 4 nicks, then the next 4 nicks etc... The end result is that you send less commands to the IRC server which reduces the load and the chance you will be disconnected for flooding.
You may also want to put in an exception if there are too many clones (Because you know you will be disconnected), e.g. if (%total > 30) set %total 30 that way you will only kick 30 of the clones even if there is more. Hey - its better than kicking no clones and its better than being disconnected for flooding the server!