Raised This Month: $ Target: $400
 0% 

[L4D2] How to lock a cvar from being modified by plugins for the duration of a map?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Proaxel
Member
Join Date: Oct 2014
Old 09-27-2023 , 05:06   [L4D2] How to lock a cvar from being modified by plugins for the duration of a map?
Reply With Quote #1

We use Config Survivors to control how certain functions of certain plugins that don't have player scaling functionality built in. The problem is when the setting of a certain convar is unsuitable for one particular level.

An example scenario: at and above a certain amount of players, Config Survivors sets a Multitanks convar to add 2 additional tanks to every tank spawn. But then some finales spawn two tanks instead of one normally, resulting in 6 tanks, which is way too much. So you would use the map configs plugin to change the appropriate Multitanks convars for those maps. But then if the number of players changes, Config Survivors will change the convar back. One could simply have map configs unload the Config Survivors, but then you'd give up other convars being controlled that way.

The closest plugin that has this functionality is ABM, but we would rather not use that anymore. As far as I'm aware there's no plugin that provides the functionality standalone.

The best way I can think of is to use stripper to add a point_servercommand and a logic_timer, and then have the timer constantly tell the point_servercommand to run the cvar change command once a second... preferably using acvar so it doesn't spam the chat... but surely somone here knows of a more elegant method right? Or, if it comes down to it... how hard would it be code-wise to replicate the convar-lock functionality ABM has?
Proaxel is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 09-27-2023 , 09:05   Re: [L4D2] How to lock a cvar from being modified by plugins for the duration of a ma
Reply With Quote #2

you can hook convar change or set upper/lower bounds for the cvar.

for convar change check:

https://wiki.alliedmods.net/ConVars_...Mod_Scripting) #Change Callbacks
__________________

Last edited by Marttt; 09-27-2023 at 09:10.
Marttt is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-27-2023 , 19:16   Re: [L4D2] How to lock a cvar from being modified by plugins for the duration of a ma
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
or set upper/lower bounds for the cvar.
https://forums.alliedmods.net/showpo...49&postcount=4
__________________
Do not Private Message @me
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode