[STOCK] Smart Download Manager
1 Attachment(s)
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 |
Re: [STOCK] Smart Download Manager
That's an awesome idea! Perfectly dynamic.
|
Re: [STOCK] Smart Download Manager
I'm sure this checks if a file doesn't exist and doesn't add to the download table right?
Very useful indeed for plugins that require certain files. |
Re: [STOCK] Smart Download Manager
Quote:
|
Re: [STOCK] Smart Download Manager
Very nice, sounds almost exactly like what I had been planning to make!
|
Re: [STOCK] Smart Download Manager
fix the code in Downloader_GetMaterialsFromMDL, .vtf to .vmt. MDL file handles only vmt materials
|
Re: [STOCK] Smart Download Manager
Quote:
i fixed it alraedy :p |
Re: [STOCK] Smart Download Manager
oh, sorry fro bothering you here. Didn't notice at 26
|
Re: [STOCK] Smart Download Manager
Please add a stock to download a whole directory and its sub directories. :)
Amazing. |
Re: [STOCK] Smart Download Manager
Quote:
PHP Code:
|
Re: [STOCK] Smart Download Manager
Quote:
Code:
new String:fileExtension[5]; |
Re: [STOCK] Smart Download Manager
well if its a folder of models that wont really do what hes probably looking for
|
Re: [STOCK] Smart Download Manager
Quote:
Quote:
ztmp is not a critical thing, I'll fix it. |
Re: [STOCK] Smart Download Manager
i have these errors in the log
Quote:
|
Re: [STOCK] Smart Download Manager
i just updated this include finally, got quite a few fixes and new features too, there are 2 stocks that might be useful outside of this include too:
FileExists2 - checks if a file exists either on disk or somewhere inside the custom folder OpenFile2 - capable of opening files inside the custom folder, for example if the path of the file is: "custom/my_plugin/test.txt" then you can just open that like this: OpenFile2("test.txt", "r"); If the file doesn't exist it will just work as the original OpenFile function |
Re: [STOCK] Smart Download Manager
I am getting this when I try to compile a plugin with smartdm included :)
Code:
/sourcemod/scripting/include\smartdm.inc(39) : error 017: undefined symbol "STRING" |
Re: [STOCK] Smart Download Manager
ive reuploaded the fixed inc, STRING was defined in my own stocks that i always include so i totally forgot about it
|
Re: [STOCK] Smart Download Manager
Quote:
|
Re: [STOCK] Smart Download Manager
Quote:
|
Re: [STOCK] Smart Download Manager
1 Attachment(s)
I've discovered a bug with model's materials that are inside custom folder not downloading. Turns out FileExists2 compares cached files by names but doesn't correctly format the filenames/paths to match.
So I did a quick fix by replacing "\" with "/" and turning filenames lowercase before comparing. Great Stock Btw, very useful:)! Edit: added fix for some uppercase paths that still weren't downloading Edit2: everything is now converted lowercase before adding to the downloads table (due to linux issues). It might not be very efficient but I'm done with this for now. Someone could probably rewrite this to use new syntax and streamline it a bit more but it appears to be working finally. |
Re: [STOCK] Smart Download Manager
not work for https://gamebanana.com/skins/145956
guard1 -guard1.dx90.vtx -guard1.phy -and all textures prisoner2 -prisoner2.dx90.vtx -prisoner2.phy -prisoner2_arms.dx90.vtx -prisoner2_arms.vvd -and all textures prisoner3 -prisoner3_arms.dx90.vtx -prisoner3_arms.vvd -gi_head_14.vtf -gi_head_nml.vtf |
Re: [STOCK] Smart Download Manager
Really useful. Thank you!
|
Re: [STOCK] Smart Download Manager
Has anyone expanded on this since? If not, I may have another look at it.
I recall having occasional issues with it back in 2015, though I could be wrong. I think this is still the best solution for downloads. You could use full folder downloaders, but still have to specify the files somewhere (some config or in code) anyways. With this include, a plugin actually using a resource, model for example, automagically parses all its dependencies without any fluff getting through. At least, that's what it should do. |
Re: [STOCK] Smart Download Manager
Quote:
Hello everyone, there is no downloading of files, in capital case. Can you help fix include ? |
| All times are GMT -4. The time now is 22:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.