View Single Post
Shao
Senior Member
Join Date: Jan 2015
Old 06-21-2021 , 14:29   Re: [L4D2 & CS:GO] VScript File Replacer (1.10a) [10-Apr-2021]
Reply With Quote #56

I found it a little hard to understand, but eventually got it to work looking hard enough, thought I'd share here for those who run dynamic difficulty servers.

However is anything wrong with this config? Can it be improved anyhow? Also is RegEx absolutely the same as everything else? I thought that using \n would have been better but \s happens to be where I was wrong.

Code:
// When a script is matched and modified they are saved to your servers /scripts/vscripts/vscripts_overrides/ folder.
// Do not save files there, they will be overwritten.
// The extension ".nut" or ".nuc" shouldn't be added to names below.

// This is an example script with comments on the features provided, delete the sections you don't need.
// For L4D2 I recommend keeping the "jukebox_dlc1", "jukebox_main" and "helms_deep" sections.
"vscript_replacer"
{
	// /* CS:GO + ANY: delete the // on this line to comment out everything and start from fresh.
	// All maps
	".+"
	{
	
		".+"
		{
		"regex"				"3"
		
		"\scm_AggressiveSpecials\s=\s[0-9]"					"\tcm_AggressiveSpecials = 0"
		"\sShouldAllowSpecialsWithTank\s=\sfalse"				"\tShouldAllowSpecialsWithTank = true"
		"\sIgnoreNavThreatAreas\s=\s[0-9]"					"\tIgnoreNavThreatAreas = 0"
		"\sEscapeSpawnTanks\s=\sfalse"					"\tEscapeSpawnTanks = True"
		"\sCommonLimit\s=\s(100|[1-9]?[0-9])"					"\t//CommonLimit"
		"\scm_CommonLimit\s=\s(100|[1-9]?[0-9])"				"\t//cm_CommonLimit"
		"\sHordeEscapeCommonLimit\s=\s(100|[1-9]?[0-9])"			"\t//HordeEscapeCommonLimit"
		"\sDocksCommonLimit\s=\s(100|[1-9]?[0-9])"				"\t//DocksCommonLimit"
		"\sDocksMegaMobSize\s=\s(100|[1-9]?[0-9])"				"\t//DocksMegaMobSize"
		"\sJunkyardCommonLimit\s=\s(100|[1-9]?[0-9])"				"\t//JunkyardCommonLimit"
		"\sSmokerLimit\s=\s[0-9]"						"\t//SmokerLimit"
		"\sJockeyLimit\s=\s[0-9]"						"\t//JockeyLimit"
		"\sBoomerLimit\s=\s[0-9]"						"\t//BoomerLimit"
		"\sHunterLimit\s=\s[0-9]"						"\t//HunterLimit"
		"\sChargerLimit\s=\s[0-9]"						"\t//ChargerLimit"
		"\sSpitterLimit\s=\s[0-9]"						"\t//SpitterLimit"
		"\sTankLimit\s=\s[0-9]"						"\t//TankLimit"
		"\scm_TankLimit\s=\s[0-9]"						"\t//cm_TankLimit"
		"\sWitchLimit\s=\s[0-9]"						"\t//WitchLimit"
		"\scm_WitchLimit\s=\s[0-9]"						"\t//cm_WitchLimit"
		"\sProhibitBosses\s=\strue"						"\tProhibitBosses = false"
		"\sDisallowThreatType\s=\s(ZOMBIE_TANK|ZOMBIE_WITCH)"		"\t//DisallowThreatType"
		"\sMobMinSize\s=\s(100|[1-9]?[0-9])"					"\t//MobMinSize"
		"\sMobMaxSize\s=\s(100|[1-9]?[0-9])"					"\t//MobMaxSize"
		"\sMobSpawnSize\s=\s(100|[1-9]?[0-9])"				"\t//MobSpawnSize"
		"\sMaxSpecials\s=\s(100|[1-9]?[0-9])"					"\t//MaxSpecials"
		"\scm_MaxSpecials\s=\s(100|[1-9]?[0-9])"				"\t//cm_MaxSpecials"
		}
		"jukebox_dlc1"
		{
			"DBG <- ::JUKEBOX_DEBUG <- true"		"DBG <- ::JUKEBOX_DEBUG <- false"
		}
		"jukebox_main"
		{
			"DBG <- ::JUKEBOX_DEBUG <- true"		"DBG <- ::JUKEBOX_DEBUG <- false"
		}
	}
	
// */



	// L4D2: This map was stolen by a megalomaniac. It used to execute the "KillServer" command when detecting MetaMod or SourceMod.
	// Why block the communities plugins? We will always reverse.
	// Since the workshop addon is now private and a fixed map was released by the community this isn't required, but kept in case it returns.

	"helms_deep"
	{
		// How do you like your credit being removed?
		"chat_messages"
		{
			"SeriouS_Samurai"		"Team Chivalry"
		}

		// Survival script
		"survival"
		{
			// Prevent changing critical cvars:
			"Convars.SetValue( \"metamod_version"				"// Convars.SetValue( \"metamod_version"
			"Convars.SetValue( \"sourcemod_version"				"// Convars.SetValue( \"sourcemod_version"
			"Convars.SetValue( \"sm_basepath"					"// Convars.SetValue( \"sm_basepath"
			"Convars.SetValue( \"sm_reserve_maxadmins"			"// Convars.SetValue( \"sm_reserve_maxadmins"
			"Convars.SetValue( \"mm_pluginsfile"				"// Convars.SetValue( \"mm_pluginsfile"
			"Convars.SetValue( \"sm_corecfgfile"				"// Convars.SetValue( \"sm_corecfgfile"
			"Convars.SetValue( \"sv_allow_wait_command"			"// Convars.SetValue( \"sv_allow_wait_command"
			"Convars.SetValue( \"mm_basedir"					"// Convars.SetValue( \"mm_basedir"
			"Convars.SetValue( \"sm_reserve_kicktype"			"// Convars.SetValue( \"sm_reserve_kicktype"
			"Convars.SetValue( \"sv_consistency"				"// Convars.SetValue( \"sv_consistency"
			"Convars.SetValue( \"sv_password"					"// Convars.SetValue( \"sv_password"
			"Convars.SetValue( \"sv_steamgroup"					"// Convars.SetValue( \"sv_steamgroup"
			"Convars.SetValue( \"cl_downloadfilter"				"// Convars.SetValue( \"cl_downloadfilter"
			"Convars.SetValue( \"cl_allowdownload"				"// Convars.SetValue( \"cl_allowdownload"
			"Convars.SetValue( \"cl_allowupload"				"// Convars.SetValue( \"cl_allowupload"
			"Convars.SetValue( \"motd_enabled"					"// Convars.SetValue( \"motd_enabled"
			"Convars.SetValue( \"motd_intros"					"// Convars.SetValue( \"motd_intros"
			"Convars.SetValue( \"motdfile"						"// Convars.SetValue( \"motdfile"
			"Convars.SetValue( \"hostfile"						"// Convars.SetValue( \"hostfile"
			"Convars.SetValue( \"lservercfgfile"				"// Convars.SetValue( \"lservercfgfile"
			"Convars.SetValue( \"sv_banid_enabled"				"// Convars.SetValue( \"sv_banid_enabled"
			"Convars.SetValue( \"sv_lan"						"// Convars.SetValue( \"sv_lan"
			"Convars.SetValue( \"survivor_allow_crawling"		"// Convars.SetValue( \"survivor_allow_crawling"
			"Convars.SetValue( \"z_holiday_gift_drop_chance"	"// Convars.SetValue( \"z_holiday_gift_drop_chance"
			"Convars.SetValue( \"changelevel_inhibit"			"// Convars.SetValue( \"changelevel_inhibit"

			// This will block all cvar changes.
			// You can remove // at the start of the next line if you want to block all other cvar changes.
			// "Convars.SetValue"			"// Convars.SetValue"
		}

		// Main script
		"helms_deep_.+_survival"
		{
			// Matches the script name and strings with RegEx.
			"regex"			"3"

			// Replace all string occurrences:

			// RegEx replace all matched SteamIDs with Gabe's SteamID.
			"(STEAM_[0-5]:[0-1]:[0-9]+)"			"STEAM_1:0:11101" // Your donators can fuck off too.

			// Gives everyone access to donator perks.
			"Utils.GetIDFromArray\(HelmsSteamIDs, player.GetSteamID\(\)\) != -1"			"1 == 1"

			// Stop forcing sv_cheats to 0.
			"function Notifications::OnServerCvarChanged::HelmsCvarChanged"			"function Wtf_Gtfo"

			// Bye. Don't bother trying to disable our stuff.
			"HelmsDisableAdminSystem\(\);"			""

			// Or not.
			// BLOCK CVAR CHANGES:

			// Prevent changing critical cvars:
			// The \ from "SetValue\("" is to escape the ( due to using regex matching. Also must escape the quote such as \"
			"Convars.SetValue\( \"metamod_version"				"// Convars.SetValue( \"metamod_version"
			"Convars.SetValue\( \"sourcemod_version"			"// Convars.SetValue( \"sourcemod_version"
			"Convars.SetValue\( \"sm_basepath"					"// Convars.SetValue( \"sm_basepath"
			"Convars.SetValue\( \"sm_reserve_maxadmins"			"// Convars.SetValue( \"sm_reserve_maxadmins"
			"Convars.SetValue\( \"mm_pluginsfile"				"// Convars.SetValue( \"mm_pluginsfile"
			"Convars.SetValue\( \"sm_corecfgfile"				"// Convars.SetValue( \"sm_corecfgfile"
			"Convars.SetValue\( \"sv_allow_wait_command"		"// Convars.SetValue( \"sv_allow_wait_command"
			"Convars.SetValue\( \"mm_basedir"					"// Convars.SetValue( \"mm_basedir"
			"Convars.SetValue\( \"sm_reserve_kicktype"			"// Convars.SetValue( \"sm_reserve_kicktype"
			"Convars.SetValue\( \"sv_consistency"				"// Convars.SetValue( \"sv_consistency"
			"Convars.SetValue\( \"sv_password"					"// Convars.SetValue( \"sv_password"
			"Convars.SetValue\( \"sv_steamgroup"				"// Convars.SetValue( \"sv_steamgroup"
			"Convars.SetValue\( \"cl_downloadfilter"			"// Convars.SetValue( \"cl_downloadfilter"
			"Convars.SetValue\( \"cl_allowdownload"				"// Convars.SetValue( \"cl_allowdownload"
			"Convars.SetValue\( \"cl_allowupload"				"// Convars.SetValue( \"cl_allowupload"
			"Convars.SetValue\( \"motd_enabled"					"// Convars.SetValue( \"motd_enabled"
			"Convars.SetValue\( \"motd_intros"					"// Convars.SetValue( \"motd_intros"
			"Convars.SetValue\( \"motdfile"						"// Convars.SetValue( \"motdfile"
			"Convars.SetValue\( \"hostfile"						"// Convars.SetValue( \"hostfile"
			"Convars.SetValue\( \"lservercfgfile"				"// Convars.SetValue( \"lservercfgfile"
			"Convars.SetValue\( \"sv_banid_enabled"				"// Convars.SetValue( \"sv_banid_enabled"
			"Convars.SetValue\( \"sv_lan"						"// Convars.SetValue( \"sv_lan"
			"Convars.SetValue\( \"survivor_allow_crawling"		"// Convars.SetValue( \"survivor_allow_crawling"
			"Convars.SetValue\( \"z_holiday_gift_drop_chance"	"// Convars.SetValue( \"z_holiday_gift_drop_chance"
			"Convars.SetValue\( \"changelevel_inhibit"			"// Convars.SetValue( \"changelevel_inhibit"

			// This will block all cvar changes.
			// You can remove // at the start of the next line if you want to block all other cvar changes.
			// "Convars.SetValue"			"// Convars.SetValue"
		}
	}
}
Attached Files
File Type: cfg vscripts_override.cfg (8.5 KB, 52 views)
Shao is offline