float cvar_clientsettemp(string tmp_cvar, string value)
{
+ float created_saved_value;
entity e;
+ if not(tmp_cvar || value)
+ {
+ dprint("Error: Invalid usage of cvar_clientsettemp(string, string); !\n");
+ return FALSE;
+ }
+
for(e = world; (e = find(e, classname, "saved_cvar_value")); )
if(e.netname == tmp_cvar)
- goto saved;
+ goto saved; // skip creation
// creating a new entity to keep track of this cvar
e = spawn();
e.classname = "saved_cvar_value";
e.netname = strzone(tmp_cvar);
e.message = strzone(cvar_string(tmp_cvar));
- return TRUE;
+ created_saved_value = TRUE;
- // an entity for this cvar already exists, update the value
+ // an entity for this cvar already exists
:saved
+
+ // update the cvar to the value given
cvar_set(tmp_cvar, value);
- return FALSE;
+
+ return created_saved_value;
}
float cvar_clientsettemp_restore()
{
case CMD_REQUEST_COMMAND:
{
- if((argv(1) == "restore") && (argc == 3))
+ if((argv(1) == "restore") && (argc == 2))
{
float i = cvar_clientsettemp_restore();
dprint("Restored ", ftos(i), " temporary cvar settings to their original values.\n");
else
dprint("Nothing to restore.\n");
+
+ return;
}
- else
+ else if(argc >= 3)
{
if(cvar_clientsettemp(argv(1), argv(2)))
dprint("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n");
else
dprint("Already had a tracker for ", argv(1), ", updating it to \"", argv(2), "\".\n");
+
+ return;
}
-
- return;
}
default:
+ print("Incorrect parameters for ^2settemp^7\n");
case CMD_REQUEST_USAGE:
{
print("\nUsage:^3 cl_cmd settemp <cvar> | [restore]\n");
float missing;
// TODO: re enable with gametype dependant cvars?
- if(argc < 2) // no arguments provided
+ if(argc < 3) // no arguments provided
argc = tokenizebyseparator(strcat("x ", autocvar_scoreboard_columns), " ");
- if(argc < 2)
+ if(argc < 3)
argc = tokenizebyseparator(strcat("x ", HUD_DefaultColumnLayout()), " ");
- if(argc == 2)
+ if(argc == 3)
{
- if(argv(1) == "default")
+ if(argv(2) == "default")
argc = tokenizebyseparator(strcat("x ", HUD_DefaultColumnLayout()), " ");
- else if(argv(1) == "all")
+ else if(argv(2) == "all")
{
string s;
s = "ping pl color name |";
hud_fontsize = HUD_GetFontsize("hud_fontsize");
- for(i = 0; i < argc - 1; ++i)
+ for(i = 0; i < argc - 2; ++i)
{
float nocomplain;
- str = argv(i+1);
+ str = argv(i+2);
nocomplain = FALSE;
if(substring(str, 0, 1) == "?")