Black Knight's Res Creator


Introduction:
Valve included a method of downloading files apart of the map file. This was developed, so wad files or other map specific files could be downloaded from the server to the client at mapchange.
Due to it's purpose res files are completely map specific which means that there is no default res file which is valid for all maps.
A lot of plugins for admin mod or other metamod plugins use custom sounds. These should be downloaded on every map. So you had to edit ALL res files which is a heck of a work, especially if you have a lot of maps. Installation of plugins which use custom files is therefore extremely time-consuming.
The idea was to create a plugin, which creates those res files automatically.


Features:
- Creates res files
- Includes map specific files in the res file (needed on a specific map)
- Includes globally used files in the res file (needed on all maps)
- Includes files passed from plugins in the res file (needed on all maps)


Installation:
1. Compile the plugin (see manual for instruction on how to compile plugins)
2. Upload file and edit plugin.ini (IMPORTANT: plugin_bk_res MUST be the very LAST PLUGIN in the list in order to work properly!!!)
3. Create the directory addons/adminmod/config/res
4. Do a mapchange
5. Now it is installed.


Configuration:
1. How to include map specific files?
Move the map specific res files to the directory addons/adminmod/config/res (i.e. fy_iceworld.res). These res files should only include those files which are needed to play the map (No plugin related stuff).

2. How to include files on every map?
Create a default.res (usual text editor) and insert the files which should be downloadable on every map. Here we put in any files needed by plugins etc.

3. For which maps should res files being created?
By default the plugin creates res files for every map found in the mapcycle.txt. You can create your own list in another file of course. Just do it like it is done in the mapcycle.txt and include the maps for which res files should be created.
You need to alter admin_res_maps in order to get the new list working:
admin_res_maps <name of maps file>: Sets maps file or returns the current setting, if no file was specified.

4. How to create the res files now?
Execute:
admin_res_refresh [map name]: Recreates the res files. If a map name is specified, it would only recreate the res file of that specific map.
You have to use this command every time you make changes to the res files.

5. How to check whether everything worked well?
Just go to your maps directory and check the created res files. ;-)

6. Is it possible to have this even easier?
It is possible that plugins communicate directly with this plugin, thus you might not have to to do anything anymore but compiling and uploading the plugin related files. More information for programmers in the next section.


For programmers:
You can add your custom files directly, without having the user edit the res files manually, not even in the directory addons/adminmod/config/res.

Add to plugin_init():
plugin_registercmd("res_refresh","res_refresh",ACCESS_CONFIG,"");

Create a function res_refresh():
public res_refresh(HLCommand,HLData,HLUserName,UserIndex){

	return PLUGIN_CONTINUE;
}

Inside this function, you should add every file you want to be written in the res files, e.g:
public res_refresh(HLCommand,HLData,HLUserName,UserIndex){
	plugin_exec("res_add","sound/testwavplugin1.wav");
	plugin_exec("res_add","sound/testwavplugin2.wav");
	plugin_exec("res_add","sound/testwavplugin3.wav");
	return PLUGIN_CONTINUE;
}

That's it. You might also start the refresh work by issuing admin_res_refresh via plugin_exec(). That way the plugin_bk_res will execute your res_refresh function automatically.


Changelog:
1.1 (10.05.2005) Access level problem solved which I wasn't aware of as I tested from server console directly. (found by GotNoScope from OzForums)
1.0 (11.04.2005) First Release