public static void SetValue(string var_name, float value) { if (value == (int)value) { Cvar.Set(var_name, "" + (int)value); } else { Cvar.Set(var_name, "" + value.ToString(CultureInfo.InvariantCulture)); } }
private static void reconfigure(bool clear) { Cbuf.AddText("exec default.cfg\n"); Cbuf.AddText("bind MWHEELUP weapnext\n"); Cbuf.AddText("bind MWHEELDOWN weapprev\n"); Cbuf.AddText("bind w +forward\n"); Cbuf.AddText("bind s +back\n"); Cbuf.AddText("bind a +moveleft\n"); Cbuf.AddText("bind d +moveright\n"); Cbuf.Execute(); Cvar.Set("vid_fullscreen", "0"); Cbuf.AddText("exec config.cfg\n"); Cbuf.AddEarlyCommands(clear); Cbuf.Execute(); }
/** * Handles variable inspection and changing from the console. */ public static bool Command() { cvar_t v; // check variables v = Cvar.FindVar(Cmd.Argv(0)); if (v == null) { return(false); } // perform a variable print or set if (Cmd.Argc() == 1) { Com.Printf("\"" + v.name + "\" is \"" + v.@string + "\"\n"); return(true); } Cvar.Set(v.name, Cmd.Argv(1)); return(true); }
/** * Sets a float value of a variable. * * The overloading is very important, there was a problem with * networt "rate" string --> 10000 became "10000.0" and that wasn't right. */ public static void SetValue(string var_name, int value) { Cvar.Set(var_name, "" + value); }