This has been done many times already, you can try searching for it on this forum ("seen script" or !seen or something like that, make sure you search a few months back)

If you decide to script it yourself, you might want to type and read /help on join (and on part), /help on quit, /help on kick for when to register a change, and then find a way to save this info. You can use ini files (/help /writeini and /help $readini), regular files (/help /write and /help $read) or hash tables (/help hash tables, don't forget to save them to a file when you close down mIRC (help on exit)