I did a mod once that had similar intent as yours. Sadly, I did not have the time and energy to keep it up to date. If you need inspiration, you might want to take a look. Also, feel free to copy any bits of code that you like.
It is this one:
Moddb.com
DokBrok
joined
This member has provided no bio about themself...