; ; seen.mrc ; ; Please remember that this script is still only a beta version and that there ; probably are a few bugs left in the code. ; The script will store the time/date anyone left or joined a channel, changed ; their nick or left irc, and show this whenever someone uses "!seen ". ; The data is saved in seen.ini in your mIRC directory. A simple floodprotection ; is also added to keep lamers from flooding it. More than five requests within ; sixty seconds and all !seen commands are ignored for one minute. ; ; BTW, the seen.ini file will grow pretty huge over time. Some could call this ; a bug...it might be a good idea to keep an eye on it when it grows. ; ; Addition! ; I added a seenclean alias ("/seenclean ") that will automatically ; remove all old users from the seen.ini file. This command is always run when ; you start mIRC to keep your seen.ini from getting too huge without you noticing ; it. If you wanna disable this or change the timeframe please read the comment ; below. ; ; History: ; * added "lines per second" in seenclean. practical use? none. coolness? yes. ; * fixed some more code, like when stupid people remove seen.ini and call it ; a bug for some reason...argh ; * fixed a small thing again, floodprotection is smarter now ; * changed the seenclean function, works 10-90% faster now depending on ; your system and seen.ini length ; ; -- ; Faile ; alias seenclean { if ($1 == $null) { echo -a [ seen ] syntax: /seenclean echo -a [ seen ] this will remove every nick from the database that is older than seconds echo -a [ seen ] "/seenclean 2419200" would for example remove every userrecord old than one month echo -a [ seen ] "/seenclean 604800" would remove everyone old than one week } elseif ($exist(seen.ini) == $false) { echo -a [ seen ] seen.ini was not found in your mIRC directory echo -a [ seen ] a new one will automatically be created for you when a !seen action occurs } else { echo -a [ seen ] removing old seen records (over $duration($1) old) from seen.ini echo -a [ seen ] this might take a while (seen.ini contains $lines(seen.ini) lines)... var %i = 1, %j = 0, %k = $ctime, %l = $lines(seen.ini) while (%i <= %l) { if ($calc($ctime - $gettok($read(seen.ini,l,%i),3,32)) > $1) { write -dl $+ %i seen.ini inc %j } inc %i } echo -a [ seen ] ...done! %j nicks removed from database in $duration($calc($ctime - %k)) - $round($calc((%l + 1) / ($ctime - %k + 1)),1) lines per second } } on *:join:#:{ write -s $+ $nick seen.ini $nick join $ctime $address $chan } on *:kick:#:{ write -s $+ $knick seen.ini $knick kick $ctime $gettok($address($knick,5),2,33) $chan } on *:nick:{ write -s $+ $nick seen.ini $nick nick $ctime $address $newnick } on *:part:#:{ write -s $+ $nick seen.ini $nick part $ctime $address $chan } on *:quit:{ write -s $+ $nick seen.ini $nick quit $ctime $address } ; If you dont want to remove everyone older than one month on every startup please comment the ; following line as well, but be warned that your seen.ini might grow REALLY HUGE! I dont ; recommend this, but rather that you increase the duration to something like two or three ; months. ; Add a ";" to the beginning of the next line to kill the seenclean on startup. on *:start:{ seenclean 2419200 } on *:text:!seen *:#:{ if ((%stfuflood == $null) || (%stfuflood <= 60)) { inc -z %seenflood 12 if ($2 ison $chan) { msg $chan $2 is still here. } elseif ($read(seen.ini,s,$2) == $null) { msg $chan I've never seen $2 before. } else { var %i = $read(seen.ini,s,$2), %j = $gettok(%i,1,32), %k = $duration($calc($ctime - $gettok(%i,2,32))), %l = $gettok(%i,3,32), %m = $gettok(%i,4,32) if (%j == join) { msg $chan I last saw $2 ( $+ %l $+ ) joining %m %k ago. } elseif (%j == kick) { msg $chan I last saw $2 ( $+ %l $+ ) being kicked from %m %k ago. } elseif (%j == nick) { msg $chan I last saw $2 ( $+ %l $+ ) changing nick to %m %k ago. } elseif (%j == part) { msg $chan I last saw $2 ( $+ %l $+ ) leaving %m %k ago. } elseif (%j == quit) { msg $chan I last saw $2 ( $+ %l $+ ) leaving irc %k ago. } } } }