AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   CreateConVar exits, what about DeleteConVar ? (https://forums.alliedmods.net/showthread.php?t=306655)

Visual77 04-09-2018 07:07

CreateConVar exits, what about DeleteConVar ?
 
Like the topic says. When I unload a certain plugin, I would like all of its created convars to be removed from the server memory. Is that possible, without restarting the server?

ThatKidWhoGames 04-09-2018 10:41

Re: CreateConVar exits, what about DeleteConVar ?
 
This is actually a great question. I imagined closing the ConVar handles would automatically delete the ConVars themselves, however, it doesn't.

Visual77 04-09-2018 13:13

Re: CreateConVar exits, what about DeleteConVar ?
 
Someone asked the same question in 2007 and Bailopan said no. If nothing has changed, this probably still stands true to this day. What would it take for the sm-devs to include such a feature in the developer versions of SM?

Another thing I'm trying to figure out. Plugin A creates cvar1 with the FCVAR_NOTIFY flag. Plugin B removes the FCVAR_NOTIFY flag from cvar1. But in HLSW, gametracker, gamemonitor, cvar1 remains with the NOTIFY flag. Why is that? The flag is gone but the FCVAR_NOTIFY is somehow still in server memory. (clearing provider cache in HLSW doesn't work here).

Mitchell 04-09-2018 13:24

Re: CreateConVar exits, what about DeleteConVar ?
 
Why do you need to delete the convar, only one plugin should be creating it. If you want to find it in another plugin use FindConVar()

Visual77 04-09-2018 13:34

Re: CreateConVar exits, what about DeleteConVar ?
 
I want to delete them in order to tidy up the A2S_RULES list (the publicly quired server convars).

Lets say I load a plugin that is creating 10 public cvars with FCVAR_NOTIFY. During play, I unload this plugin without restarting the server that day. 1. The ConVars will still be in memory. and 2. They are still going to show up in the A2S_Rules list. These ConVars will be falsely quiered by HLSW, when the plugin is not even loaded on the server anymore.

Mitchell 04-09-2018 13:45

Re: CreateConVar exits, what about DeleteConVar ?
 
I don't think HLSW is also setup to "forget" and recache what it found from the server.

Visual77 04-09-2018 13:53

Re: CreateConVar exits, what about DeleteConVar ?
 
Quote:

Originally Posted by Mitchell (Post 2586925)
I don't think HLSW is also setup to "forget" and recache what it found from the server.

You are right there, but I did some more tests (like installing HLSW on a virtual machine for the first time). The convars are unfortunetly still there? Only a reboot really clears the convars from HLSW, however I really want to avoid reboots when the server is full.

psychonic 04-09-2018 18:15

Re: CreateConVar exits, what about DeleteConVar ?
 
Quote:

Originally Posted by Visual77 (Post 2586923)
Lets say I load a plugin that is creating 10 public cvars with FCVAR_NOTIFY. During play, I unload this plugin without restarting the server that day. 1. The ConVars will still be in memory. and 2. They are still going to show up in the A2S_Rules list. These ConVars will be falsely quiered by HLSW, when the plugin is not even loaded on the server anymore.

The A2S_Rules responses are provided by the steamclient bin. It has its own caching, and do not provide a way to clear a value, only a way to add/set a value and to clear all values. While workarounds could be made in SM (clearing all and re-adding all current NOTIFY values when the flag is cleared from one), SM doesn't interact directly with the Steamworks interfaces. You could probably do your own workaround using the Steamworks extension posted in the Extensions forum section. Look for AddKeyValue and ClearKeyValues.

Powerlord 04-09-2018 20:08

Re: CreateConVar exits, what about DeleteConVar ?
 
Quote:

Originally Posted by Visual77 (Post 2586843)
Like the topic says. When I unload a certain plugin, I would like all of its created convars to be removed from the server memory. Is that possible, without restarting the server?

CreateConVar tells SourceMod to create a convar or if that convar already exists, return the handle for it.

The second half of the above sentence should tell you why DeleteConVar doesn't exist.

Quote:

Originally Posted by ThatKidWhoGames (Post 2586890)
This is actually a great question. I imagined closing the ConVar handles would automatically delete the ConVars themselves, however, it doesn't.

When SourceMod creates a convar, SourceMod's core owns said convar (not the plugin) and it sets up the handle security so that plugins/extensions can't close the handle for said convar.

Edit 2 (Edit 1 got baleeted): In the Source 2013 source code, the only command I see for unregistering a ConVar will unregister every convar that a DLL owns. As I mentioned above, SourceMod owns all convars it creates on behalf of a plugin.

Visual77 04-10-2018 04:42

Re: CreateConVar exits, what about DeleteConVar ?
 
1 Attachment(s)
Quote:

Originally Posted by psychonic (Post 2586969)
The A2S_Rules responses are provided by the steamclient bin. It has its own caching, and do not provide a way to clear a value, only a way to add/set a value and to clear all values. While workarounds could be made in SM (clearing all and re-adding all current NOTIFY values when the flag is cleared from one), SM doesn't interact directly with the Steamworks interfaces. You could probably do your own workaround using the Steamworks extension posted in the Extensions forum section. Look for AddKeyValue and ClearKeyValues.

These you mean?
Code:

native bool:SteamWorks_SetRule(const String:sKey[], const String:sValue[]);
native bool:SteamWorks_ClearRules();

Afaik, steamworks is only csgo, css, tf2. A linux fork exists somewhere with limited support for l4d2. I need .dll bins here.

Here's a test plugin btw of something I'm trying to achieve. I'm adding sv_region to A2S_Rules list, on plugin unload or convar unload, well you know what I want to do. Like you said, it doesn't clear the convar from the A2S list.


All times are GMT -4. The time now is 03:12.

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