Skip to content

Files in modules

KissLick edited this page Oct 16, 2015 · 7 revisions

TeamGames uses [DTC] DownloadTableConfig include to manage all files and downloads and also allows modules to use it as well. With this, it's pretty easy to use files in modules.

Example:

public TG_OnDownloadFile(String:file[], String:prefixName[], Handle:args, &bool:known)
{
	if (StrEqual(prefixName, "MyModuleModel", false)) {
		PrecacheModel(file);
		strcopy(g_Model, sizeof(g_Model), file);
		
		// without setting known to true, TeamGames will log this as unused file!
		known = true;
	}
	
	if (StrEqual(prefixName, "MyModuleMaterial", false)) {
		ReplaceStringEx(file, PLATFORM_MAX_PATH, "materials/", "");
		PrecacheDecal(file);
		strcopy(g_Material, sizeof(g_Material), file);
		
		// getting numeric prefix argument with DTC
		g_MaterialArgument = DTC_GetArgNum(args, 1, 100);
		
		// without setting known to true, TeamGames will log this as unused file!
		known = true;
	}
}

And of course to use DTC functions, you need to include DTC.

Clone this wiki locally