This is a small snippet that can automatically detect all the files related to an .mdl/.vmt and add them to the downloads table automatically. It also works with other file types, it will just skip the extra code for those. To use it simply include the inc file and change AddFileToDownloadsTable function calls to Downloader_AddFileToDownloadsTable. It also has caching so it should only parse the files once and on next function call it will just use the cache. Let me know if it doesn't work with some .mdl/.vmt so I can fix it.
Changelog:
1.0 - Initial release
1.1 - Fixed bug with models that have mulitple VMT files
1.2 - Fixed bug that 1.1 caused, lmao
1.5 - Quite a lot of fixes, support for files inside the "custom" directory
1.6 - Added missing define