AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [INC] DTC - DownloadTableConfig (https://forums.alliedmods.net/showthread.php?t=260887)

KissLick 04-02-2015 14:08

[INC] DTC - DownloadTableConfig
 
Ciao guys,

I made this include for my plugins and now I decided to make it public for you all.

With DTC you can easily create download config and give some files prefixes, which highlight that file on config loading (and also can contain some arguments set by server master).
You no more need to create bunch of convars or KeyValue config for settings of your files (like scale of the texture, team for the texture etc.).

More info and downloads in GitHub repository and if you find any bugs, let me know please.

Config example:
PHP Code:

// comment line
# comment line
comment line

[GamePrepare 3]     sound/timeleft/en/unreal/3sec.mp3
[GamePrepare 2]     sound/timeleft/en/unreal/2sec.mp3
[GamePrepare 1]     sound/timeleft/en/unreal/1sec.mp3

[GameEnd RedTeam]   sound/sm_hosties/noscopestart1.mp3
[GameEnd BlueTeam]  sound/sm_hosties/noscopestart1.mp3

[PlayerSkin Redmodels/player/prisoner/prisoner_red_fix.mdl
    models
/player/prisoner/prisoner_red_fix.dx90.vtx
    models
/player/prisoner/prisoner_red_fix.phy
    models
/player/prisoner/prisoner_red_fix.vvd

[PlayerSkin Bluemodels/player/prisoner/prisoner_blue_fix.mdl
    models
/player/prisoner/prisoner_blue_fix.dx90.vtx
    models
/player/prisoner/prisoner_blue_fix.phy
    models
/player/prisoner/prisoner_blue_fix.vvd

[Mark Red 12.0 0.125materials/decals/custom/redstar.vmt
    materials
/decals/custom/redstar.vtf

[Mark Blue 12.0 0.125materials/decals/custom/bluestar.vmt
    materials
/decals/custom/bluestar.vtf 

How to use:
  1. Include DTC
    PHP Code:

    #include <dtc> 

  2. Create config (optional)
    PHP Code:

    public OnPluginStart()
    {
        
    DTC_CreateConfig(ConfigPathOnCreateConfig);
    }

    public 
    OnCreateConfig(String:sConfigPath[], Handle:hConfigFile)
    {
        
    WriteFileLine(hConfigFile"// [Mark <team> <scale> <offset>]");
        
    WriteFileLine(hConfigFile"");
        
    WriteFileLine(hConfigFile"[Mark Red 0.125 12.0] materials/sprites/laserbeam.vmt");


  3. Load config
    PHP Code:

    public OnPluginStart()
    {
        
    DTC_LoadConfig(ConfigPathOnFile);
    }

    public 
    OnFile(String:sFile[], String:sPrefixName[DTC_MAX_NAME_LEN], Handle:hArgs)
    {
        
    // Catch file with prefix "Mark"
        
    if (StrEqual(sPrefixName"Mark")) {

                new 
    String:sHelper[64];
                
    DTC_GetArg(hArgs1sHelpersizeof(sHelper), "ERROR");

                
    LogMessage("File = '%s'"sFile);
                
    LogMessage("Arg1 = '%s'"sHelper);
                
    LogMessage("Arg2 = '%.3f'"DTC_GetArgFloat(hArgs20.0));
                
    LogMessage("Arg3 = '%.3f'"DTC_GetArgFloat(hArgs3, -1.0));
        }



lowie 05-01-2015 05:34

Re: [INC] DTC - DownloadTableConfig
 
works well, I used this.

KissLick 05-02-2015 17:01

Re: [INC] DTC - DownloadTableConfig
 
Thx, any suggestions appreciated.


All times are GMT -4. The time now is 23:03.

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