Raised This Month: $51 Target: $400
 12% 

[Dev + Any] Files Management Interface


Post New Thread Reply   
 
Thread Tools Display Modes
Author
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Plugin ID:
3460
Plugin Version:
1.0.2
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    6 
    Plugin Description:
    Allows files-in-folder precache/dl and random file accessor
    Old 01-11-2013 , 00:31   [Dev + Any] Files Management Interface
    Reply With Quote #1

    Files Management Interface

    v. 1.0.2

    Foreword : I made this plugin because SM File/Folder Downloader and Precacher was good, but I believe it missed essential functions, plus it was indirectly made for a paid request.

    Features :
    • Allows to easily precache all the files in a folder, by both Natives and a read file.
    • Files are read according to their extensions. ".mp3" will be considered like sounds, ".mdl" models, etc.
    • Provides Natives to easily request a random file for other plugins.

    Known bugs :
    • You may encounter problems with L4D(2); this seems to be a problem proper to how L4D was built, being repulsive to 3rd party files .

    CVars :
    • filesmanagementinterfaceversion: Gives version -_-'
    • ----------
    • fmi_file : File to read that will contain the folder paths which will have their files precached & downloaded. Can be a filepath.
    • ----------
    • fmi_fileext_sound : File extensions to precache and consider sounds when using the interface (.inc). Default ".mp3 .wav".
    • fmi_fileext_model : File extensions to precache and consider models when using the interface (.inc). Default ".mdl".
    • fmi_fileext_decal : File extensions to precache and consider decals when using the interface (.inc). Default ".vmt".
    • fmi_fileext_generic : File extensions to precache and consider generics when using the interface (.inc). Default ".pcf".
    • fmi_fileext_downloadonly : File extensions that will be downloaded, but not accessible via the interface (.inc). Default ".phy .vtx .vvd .vtx .vtf".
    • fmi_fileext_nodownload : File extensions that won't be downloaded but will be accessible via the interface (.inc). Default ".txt .ini .cfg".
    • fmi_fileext_ignore : File extensions that won't be downloaded/precached (directly) nor accessible via the interface (.inc), when using fmi_file. This ConVar sole purpose is to prevent console spamming of 'unrecognized extensions'. Default ".ztmp .bz2".
    • Note some ConVar can't have their extensions removed. This is a wanted behaviour to ensure that plugins using this interface will precached correctly some files (i.e. you can't remove ".mp3").

    Commands :
    • sm_fmi_reloadfiles : Reload the folders specified in the ConVar 'fmi_file'. This could break plugins communication with this interface until next map load. Use it carefully.

    Notes :
    • Put the .inc in the include folder to compile.
    • The .ini is optional and serves to download/precache entire (and entire only) folders (alternative to SM File/Folder Downloader and Precacher )
    • See 2nd post for a list of plugin that uses this interface.
    • See 3rd post for a quick explanation on how to use this interface (for developpers).
    • Tested under both CSS & CSGO.
    • Thanks to psychonic for his CSGO quirks and newer mod folder names.

    --------------

    Any suggestions/comments on the code or the plugin are welcomed and appreciated.

    Changelog :
    • 1.0.0 Initial release. (11-01-2013)
    • 1.0.1 Added ".bz2" extensions to ignore ConVar. (11-01-2013)
    • 1.0.2 Changed .inc to make the function of this interface optional. No need to redownload if its functional for you (beside version .sp didn't change). (26-10-2013)
    Attached Files
    File Type: ini filesmanagementinterface.ini (348 Bytes, 2806 views)
    File Type: inc filesmanagementinterface.inc (8.5 KB, 1659 views)
    File Type: smx filesmanagementinterface.smx (13.6 KB, 1564 views)
    File Type: sp Get Plugin or Get Source (filesmanagementinterface.sp - 959 views - 30.0 KB)
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 10-26-2013 at 20:47. Reason: 267inc/149sp/288mx ; changed .inc
    RedSword is offline
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 01-11-2013 , 00:31   Re: [Dev + Any] Files Management Interface
    Reply With Quote #2

    Plugins using this interface (by me) :


    Plugins using this interface (by others) :
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 01-12-2013 at 22:39.
    RedSword is offline
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 01-11-2013 , 00:31   Re: [Dev + Any] Files Management Interface
    Reply With Quote #3

    To plugin developpers :

    You need two things :

    1 : OnConfigsExecuted, use the appropriate function (see under "//===== Precache folder" in the .inc) to precache the appropriate ressources

    2 : When needed, use the "FMI_GetRandom*" functions with the path to the folder of the ressources. Careful, as SOUNDS does not need the "sound/" part in the string. The function will be used to get a string, that you should be able to directly use via functions such as EmitSoundToClient() for sounds.

    Also note that this plugins allows to get a random .txt (or .ini or whatever). You can use that to load a random config for a certain plugin. Just read the .inc ;).

    Red
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 01-11-2013 at 00:56.
    RedSword is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 01-11-2013 , 07:13   Re: [Dev + Any] Files Management Interface
    Reply With Quote #4

    Suggestions:

    -add .bz2 in fmi_fileext_nodownload for default because some people use FTP server also as FastDownload so .bz2 and normal format files (both) will be downloaded (as I step with the old plugin ), and because a .bz2 file in client-side is useless

    -For DEV: Maybe add a native as "OnFileAdd" for can block that added a certain file

    btw, Nice work
    __________________
    Veteran Coder -> Activity channel
    Coding on CS2 and taking paid and free jobs.

    Contact: Steam, Telegram or discord ( franug ).

    You like my work? +Rep in my steam profile comments or donate.


    Last edited by Franc1sco; 01-11-2013 at 07:14.
    Franc1sco is offline
    Send a message via MSN to Franc1sco
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 01-11-2013 , 07:29   Re: [Dev + Any] Files Management Interface
    Reply With Quote #5

    Quote:
    Originally Posted by Franc1sco View Post
    Suggestions:

    -add .bz2 in fmi_fileext_nodownload for default because some people use FTP server also as FastDownload so .bz2 and normal format files (both) will be downloaded (as I step with the old plugin ), and because a .bz2 file in client-side is useless

    -For DEV: Maybe add a native as "OnFileAdd" for can block that added a certain file

    btw, Nice work
    For first point : does the client download the .bz2, which is then decompressed on the client side ?

    For second point : would someone even consider using it ? It seems really to "extended" : you're a plugin developpers, using an interface and worrying about what a 3rd developper could do ? There isn't a lot of plugins like that; and I really doubt it would be used.
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work
    RedSword is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 01-11-2013 , 07:41   Re: [Dev + Any] Files Management Interface
    Reply With Quote #6

    Quote:
    Originally Posted by RedSword View Post
    For first point : does the client download the .bz2, which is then decompressed on the client side ?

    For second point : would someone even consider using it ? It seems really to "extended" : you're a plugin developpers, using an interface and worrying about what a 3rd developper could do ? There isn't a lot of plugins like that; and I really doubt it would be used.
    1- example: If you have materials/models/player/modelname.vtf and materials/models/player/modelname.vdf.bz2 the client will download both files, the first will be downloaded in bz2 format and the second will try to download in .bz2.bz2 but in client-side appear as .bz2 file and .vtf file (tested)

    2-If you want to put a file in a particular directory but you dont want to use in this plugin (I think this would be for the other plugin of sounds that you post)
    __________________
    Veteran Coder -> Activity channel
    Coding on CS2 and taking paid and free jobs.

    Contact: Steam, Telegram or discord ( franug ).

    You like my work? +Rep in my steam profile comments or donate.

    Franc1sco is offline
    Send a message via MSN to Franc1sco
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 01-11-2013 , 08:06   Re: [Dev + Any] Files Management Interface
    Reply With Quote #7

    Quote:
    Originally Posted by Franc1sco View Post
    1- example: If you have materials/models/player/modelname.vtf and materials/models/player/modelname.vdf.bz2 the client will download both files, the first will be downloaded in bz2 format and the second will try to download in .bz2.bz2 but in client-side appear as .bz2 file and .vtf file (tested)

    2-If you want to put a file in a particular directory but you dont want to use in this plugin (I think this would be for the other plugin of sounds that you post)
    No. bz2 files as the plugin currently is won't be downloaded (I mean... they will act as they ever did I believe). I added the _ignore convar to prevent spamming the console. File extensions that are in no ConVar at all will simply print a "unrecognized file extension" in the console, which can be annoying in long-term, but it is safe. That's also why the _ignore convar is said to operate when parsing the fmi_file (because the other plugin requesting via natives certain files has a certain responsibility; i.e. to not parse everything).

    2- Well, just don't put a folder with a too-generic name "sound/special" or "sound/misc" are a really good example of something to not do.

    I'll wait a bit for adding the .bz2 extension; maybe some people have more idea on what to add.

    But thanks; I'll clarify the _ignore convar in the first post.

    Red
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 01-11-2013 at 08:08.
    RedSword is offline
    ChickenFighter
    Junior Member
    Join Date: Oct 2010
    Location: Germany
    Old 01-11-2013 , 10:41   Re: [Dev + Any] Files Management Interface
    Reply With Quote #8

    Sounds really great, but I'm wondering if this would work with Left4Dead2 too.
    ChickenFighter is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 01-11-2013 , 11:09   Re: [Dev + Any] Files Management Interface
    Reply With Quote #9

    Quote:
    Originally Posted by RedSword View Post
    No. bz2 files as the plugin currently is won't be downloaded (I mean... they will act as they ever did I believe). I added the _ignore convar to prevent spamming the console. File extensions that are in no ConVar at all will simply print a "unrecognized file extension" in the console, which can be annoying in long-term, but it is safe. That's also why the _ignore convar is said to operate when parsing the fmi_file (because the other plugin requesting via natives certain files has a certain responsibility; i.e. to not parse everything).

    2- Well, just don't put a folder with a too-generic name "sound/special" or "sound/misc" are a really good example of something to not do.

    I'll wait a bit for adding the .bz2 extension; maybe some people have more idea on what to add.

    But thanks; I'll clarify the _ignore convar in the first post.

    Red
    Add .bz2 to fmi_fileext_ignore as a plugin should never be telling clients to download bz2s. Clients will automatically check for a .bz2 of any file in the downloads table.

    If models/something.mdl is in the downloads table and a fast download server is being used:
    • The client requests models/something.mdl.bz2
    • If the client could download a bz2, it decompresses it.
    • If the client couldn't download a bz2, it requests models/something.mdl
    __________________
    Not currently working on SourceMod plugin development.

    Last edited by Powerlord; 01-11-2013 at 11:12.
    Powerlord is offline
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 01-11-2013 , 20:17   Re: [Dev + Any] Files Management Interface
    Reply With Quote #10

    Quote:
    Originally Posted by Powerlord View Post
    Add .bz2 to fmi_fileext_ignore as a plugin should never be telling clients to download bz2s. Clients will automatically check for a .bz2 of any file in the downloads table.

    If models/something.mdl is in the downloads table and a fast download server is being used:
    • The client requests models/something.mdl.bz2
    • If the client could download a bz2, it decompresses it.
    • If the client couldn't download a bz2, it requests models/something.mdl
    Please reread what you quoted.

    *_ignore ConVar serve only to prevent console spamming. If it not found in any other ConVar, it won't get downloaded.

    Quote:
    Originally Posted by ChickenFighter View Post
    Sounds really great, but I'm wondering if this would work with Left4Dead2 too.
    It should.
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 01-11-2013 at 20:18.
    RedSword is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 18:19.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode