• ConVar resets on restart with FCVAR_ARCHIVE set
    5 replies, posted
I'm creating a mod to change the look of the Detective/Traitor menu in TTT. For that I have created a serverside ConVar which allows users to make changes to their menu or not. I created the ConVar with the following code in the [B]lua -> autorun[/B] folder: [CODE] local allowChange = CreateConVar("ttt_bem_allow_change", 1, { FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_SERVER_CAN_EXECUTE }, "Allow clients to change the look of the Traitor/Detective menu" ) [/CODE] Changing and Reading from it works fine, but everytime I restart my server the value is reset to the default one, even with the flag [I]FCVAR_ARCHIVE[/I] set... I have a feeling that I'm setting it in the wrong place at the wrong time but I don't know where I have to do it to make it work. The full code can be found here: [URL="https://github.com/hendrikbl/ttt-bem/tree/development"]https://github.com/hendrikbl/ttt-bem/tree/development[/URL] Thanks!
Have you checked your server.vdf file? I ran the same line of code the same way you did and it changed fine. If your server.vdf doesn't contain and entry for your cvar make sure that the server is able to write to that file. Also check if any other cvars don't save the way they should.
How are you restarting your server? From past experience, simply exiting out of the server process (or killing it) will result in the archived value never being written back to server.vdf. To ensure it gets written, the server must be stopped via something like 'exit' (and possibly '_restart').
[QUOTE=Mista Tea;51988244]How are you restarting your server? From past experience, simply exiting out of the server process (or killing it) will result in the archived value never being written back to server.vdf. To ensure it gets written, the server must be stopped via something like 'exit' (and possibly '_restart').[/QUOTE] When I tested this it actually saved when just killing srcds.
[QUOTE=TrailerDorken;51988294]When I tested this it actually saved when just killing srcds.[/QUOTE] It's possible that other factors such as OS come into play, or that this issue has since been resolved. I distinctly had issues with archived convars saving a year ago to the point that I had to inform users of my tool about it to ensure their settings copied over [url]https://facepunch.com/showthread.php?t=1399120&p=50216992&viewfull=1#post50216992[/url]
[QUOTE=Mista Tea;51988244]How are you restarting your server? From past experience, simply exiting out of the server process (or killing it) will result in the archived value never being written back to server.vdf. To ensure it gets written, the server must be stopped via something like 'exit' (and possibly '_restart').[/QUOTE] This did the trick! :) When simply killing it it doesn't get saved, I have to do a clean exit for it to be written in the server.vdf. I thought it would change the value there when changing it in the server console not on exit... Thanks! :)
Sorry, you need to Log In to post a reply to this thread.