View Single Post
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 03-09-2020 , 13:35   Re: [TF2] Little Anti-Cheat
Reply With Quote #2

In cvar_change, you can actually replace this type of check:
Code:
	if (StrEqual(cvarname, "lilac_enable", false)) {
		icvar[CVAR_ENABLE] = StringToInt(newValue, 10);
	} else if (StrEqual(cvarname, "lilac_sourcebans", false)) {
		icvar[CVAR_SB] = StringToInt(newValue, 10);
to:
Code:
	if ( convar == hCvar[CVAR_ENABLE] ) { // Store ConVar handles globally as Handle or ConVar (on new syntax) -typed
		icvar[CVAR_ENABLE] = StringToInt(newValue, 10);
	} else if ( convar == hCvar[CVAR_SB] ) {
		icvar[CVAR_SB] = StringToInt(newValue, 10);

	// etc...
	// The thing is that ConVar Handle is never changed after creating so you don't need to check for convar name
	// just directly check convar handle
Also, you should probably add translation support for hardcoded messages.
__________________

Last edited by MAGNAT2645; 03-09-2020 at 13:41.
MAGNAT2645 is offline