|  | @@ -13,7 +13,7 @@
 | 
	
		
			
				|  |  |  #include <stocksoup/files>
 | 
	
		
			
				|  |  |  #include <stocksoup/version>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -#define PLUGIN_VERSION "1.1.1"
 | 
	
		
			
				|  |  | +#define PLUGIN_VERSION "1.1.2"
 | 
	
		
			
				|  |  |  public Plugin myinfo = {
 | 
	
		
			
				|  |  |  	name = "[CSRD] SRCDS Automatic Data Dumper",
 | 
	
		
			
				|  |  |  	author = "nosoop",
 | 
	
	
		
			
				|  | @@ -41,12 +41,32 @@ enum DumpAction {
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  DumpAction g_DumpAction;
 | 
	
		
			
				|  |  | +StringMap g_ConCommandFlagCache;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  public APLRes AskPluginLoad2(Handle hPluginSelf, bool bLateLoaded, char[] error, int err_max) {
 | 
	
		
			
				|  |  |  	if (bLateLoaded) {
 | 
	
		
			
				|  |  |  		g_DumpAction = DumpAction_None;
 | 
	
		
			
				|  |  |  	} else {
 | 
	
		
			
				|  |  |  		g_DumpAction = DumpAction_FileCheck;
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		/**
 | 
	
		
			
				|  |  | +		 * cache flags early in case a plugin overrides flags
 | 
	
		
			
				|  |  | +		 * https://github.com/nosoop/SM-ConVarConfigs does this when all plugins are loaded
 | 
	
		
			
				|  |  | +		 */
 | 
	
		
			
				|  |  | +		g_ConCommandFlagCache = new StringMap();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		char commandName[128];
 | 
	
		
			
				|  |  | +		bool bIsCommand;
 | 
	
		
			
				|  |  | +		int flags;
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		Handle hConCommandIter = FindFirstConCommand(commandName, sizeof(commandName),
 | 
	
		
			
				|  |  | +				bIsCommand, flags);
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		do {
 | 
	
		
			
				|  |  | +			g_ConCommandFlagCache.SetValue(commandName, flags);
 | 
	
		
			
				|  |  | +		} while ( FindNextConCommand(hConCommandIter, commandName, sizeof(commandName),
 | 
	
		
			
				|  |  | +				bIsCommand, flags) );
 | 
	
		
			
				|  |  | +		delete hConCommandIter;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	return APLRes_Success;
 | 
	
	
		
			
				|  | @@ -70,6 +90,10 @@ public void OnMapStart() {
 | 
	
		
			
				|  |  |  				ForceChangeLevel(LOW_ENTITY_MAP, "Starting server data dump");
 | 
	
		
			
				|  |  |  			} else {
 | 
	
		
			
				|  |  |  				g_DumpAction = DumpAction_None;
 | 
	
		
			
				|  |  | +				
 | 
	
		
			
				|  |  | +				// we're not dumping, so there's no point in keeping the cache
 | 
	
		
			
				|  |  | +				delete g_ConCommandFlagCache;
 | 
	
		
			
				|  |  | +				g_ConCommandFlagCache = null;
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		
 | 
	
	
		
			
				|  | @@ -167,20 +191,26 @@ void DumpServerCommands(const char[] format, any ...) {
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	outputFile.WriteLine("\"%s\",\"%s\",\"%s\"", "Names", "Flags", "Help Text");
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  | -	Handle hConCommand = FindFirstConCommand(commandName, sizeof(commandName), bIsCommand,
 | 
	
		
			
				|  |  | +	Handle hConCommandIter = FindFirstConCommand(commandName, sizeof(commandName), bIsCommand,
 | 
	
		
			
				|  |  |  			flags, commandDescription, sizeof(commandDescription));
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	do {
 | 
	
		
			
				|  |  |  		if (bIsCommand) {
 | 
	
		
			
				|  |  | +			if (g_ConCommandFlagCache) {
 | 
	
		
			
				|  |  | +				g_ConCommandFlagCache.GetValue(commandName, flags);
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  |  			ReplaceString(commandDescription, sizeof(commandDescription), "\"", "'");
 | 
	
		
			
				|  |  |  			ReplaceString(commandDescription, sizeof(commandDescription), "\n", " / ");
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  			outputFile.WriteLine("\"%s\",\"%s\",\"%s\"", commandName,
 | 
	
		
			
				|  |  |  					GetCommandFlagString(flags), commandDescription);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -	} while ( FindNextConCommand(hConCommand, commandName, sizeof(commandName),
 | 
	
		
			
				|  |  | +	} while ( FindNextConCommand(hConCommandIter, commandName, sizeof(commandName),
 | 
	
		
			
				|  |  |  			bIsCommand, flags, commandDescription, sizeof(commandDescription)) );
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  | +	delete hConCommandIter;
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  |  	delete outputFile;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -197,11 +227,15 @@ void DumpServerConVars(const char[] format, any ...) {
 | 
	
		
			
				|  |  |  	outputFile.WriteLine("\"%s\",\"%s\",\"%s\",\"%s\"", "Names", "Defaults", "Flags",
 | 
	
		
			
				|  |  |  			"Help Text");
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  | -	Handle hConCommand = FindFirstConCommand(commandName, sizeof(commandName), bIsCommand,
 | 
	
		
			
				|  |  | +	Handle hConCommandIter = FindFirstConCommand(commandName, sizeof(commandName), bIsCommand,
 | 
	
		
			
				|  |  |  			flags, commandDescription, sizeof(commandDescription));
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	do {
 | 
	
		
			
				|  |  |  		if (!bIsCommand) {
 | 
	
		
			
				|  |  | +			if (g_ConCommandFlagCache) {
 | 
	
		
			
				|  |  | +				g_ConCommandFlagCache.GetValue(commandName, flags);
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			
 | 
	
		
			
				|  |  |  			char defaultValue[128];
 | 
	
		
			
				|  |  |  			FindConVar(commandName).GetDefault(defaultValue, sizeof(defaultValue));
 | 
	
		
			
				|  |  |  			
 | 
	
	
		
			
				|  | @@ -211,9 +245,9 @@ void DumpServerConVars(const char[] format, any ...) {
 | 
	
		
			
				|  |  |  			outputFile.WriteLine("\"%s\",\"%s\",\"%s\",\"%s\"", commandName,
 | 
	
		
			
				|  |  |  					defaultValue, GetCommandFlagString(flags), commandDescription);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -	} while ( FindNextConCommand(hConCommand, commandName, sizeof(commandName),
 | 
	
		
			
				|  |  | +	} while ( FindNextConCommand(hConCommandIter, commandName, sizeof(commandName),
 | 
	
		
			
				|  |  |  			bIsCommand, flags, commandDescription, sizeof(commandDescription)) );
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +	delete hConCommandIter;
 | 
	
		
			
				|  |  |  	delete outputFile;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |