This is a script that stores nicknames and IP addresses so that the next time that same person joins a chat that you are in the script will display them joining and shows their nick name like this "new join SomeNickName ---- ustreamer1234567~!@xxxxxxxxxxx.cm-3-4c.dynamic.xxxxxx.nl
This is good esp for ustream chats as people often join with a random name and you dont know who is joining your chat.
The script does not clean the text file it creates so it could become very large - keep that in mind.
This may cause a drain on your chat and make it hang if you are on a lot of channels so you may want to filter the channels it monitors and stores nick names on.
;you need two Remote files:
;#1 File name: on_join_to_txt_file.mrc
;-----> This script makes a file storing ip addresses and the nickname used for that IP address. If the chatter does not nick up it will not store an entry. So with time this file will grow a database of names and IP addresses and with time the script becomes increasingly more informative as people join chats
on *:JOIN:*: {
if (ustreamer !isin $nick ) {
/write -a NicknameIPs.txt $nick $+ ~ $+ $gettok($wildsite,1-,46)
}
}
;#2 File name: show-join-nick-in-chat.mrc
;-----> This script looks up new join IP's from the file that the above script makes and lists the nick name used by that IP address.
on *:JOIN:#: {
var %i 1
var %ip $gettok($wildsite,1-,46)
/echo 9 -t $chan new join $nick $+ $chr(32) $+ ---- $+ $chr(32) $+ $read(NicknameIPs.txt,w,%ip)
}
First of all you can combine them to one JOIN alias
on *:JOIN:*: {
var %ip $gettok($wildsite,1-,46)
if (ustreamer !isin $nick ) {
/write -a NicknameIPs.txt $nick $+ ~ $+ %ip
}
/echo 9 -t $chan new join $nick $+ $chr(32) $+ ---- $+ $chr(32) $+ $read(NicknameIPs.txt,w,%ip)
}
Second of all you can make it with INI Files, or even hash tables
Ini File Example:
on *:JOIN:*: {
var %ip $gettok($wildsite,1-,46)
if (ustreamer !isin $nick) {
writeini -a NicknameIPs.ini %ip full $+($nick,~,%ip)
}
echo 9 -t $chan new join $nick ---- $readini(NicknameIPs.ini,%ip,full)
}
Hash Table Example:
on *:JOIN:*: {
if (!$hget(nickjoins)) { hmake nickjoins 100 | if ($exists(NicknameIPs.hash)) { hload nickjoins NicknameIPs.hash } | else { hsave nickjoins NicknameIPs.hash } }
var %ip $gettok($wildsite,1-,46)
if (ustreamer !isin $nick) {
hadd -m nickjoins %ip $+($nick,~,%ip)
hsave nickjoins NicknameIPs.hash
}
echo 9 -t $chan new join $nick ---- $hget(nickjoins,%ip)
}
In my example it checks if the hashtable exists, IF NOT creates one and then checks if there's a file containing the database then it is loading it into our hashtable, otherwise it is creating it.
So on each join stores to our Local Database the results, and ALSO stores all the hashtable into file(this make it SLOW) if you want to be faster, you can save the database on EXIT, anyway and then it retrieves the data from the db
@ProIcons Thank you for that last bit about on EXIT. Else this script would become VERY slow when your counts ranged into the thousands and you were rewriting the entire text file every time (not to mention the wear on your drive >.>). Another option would be to save on exit and every 20 or so new records (incase mIRC crashes).
Thanks ProIcons!! I will mess with these more. Still a novice at this mIRC scripting.