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 Red] models/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 Blue] models/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.125] materials/decals/custom/redstar.vmt materials/decals/custom/redstar.vtf
[Mark Blue 12.0 0.125] materials/decals/custom/bluestar.vmt materials/decals/custom/bluestar.vtf
How to use:
- Include DTC
- Create config (optional)
PHP Code:
public OnPluginStart() { DTC_CreateConfig(ConfigPath, OnCreateConfig); }
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"); }
- Load config
PHP Code:
public OnPluginStart() { DTC_LoadConfig(ConfigPath, OnFile); }
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(hArgs, 1, sHelper, sizeof(sHelper), "ERROR");
LogMessage("File = '%s'", sFile); LogMessage("Arg1 = '%s'", sHelper); LogMessage("Arg2 = '%.3f'", DTC_GetArgFloat(hArgs, 2, 0.0)); LogMessage("Arg3 = '%.3f'", DTC_GetArgFloat(hArgs, 3, -1.0)); } }
|