How do I make ConVar "save"?

I made some convars like this:

if not ConVarExists("cl_dosomething") then
    CreateClientConVar("cl_dosomething", '1', FCVAR_NOTIFY)

How do I make it so it saves so when I change cl_dosomething to 0, so when I start gmod again, the convar is on 0?


You could use file.Write/Append, and access it with file.Read.

[editline]24th February 2014[/editline]

You can also set the desired value in a cfg file as a command to run on startup.

Replace FCVAR_NOTIFY with true

Wow, didn’t know about that.

Thank you a lot!