{
if(argc >= 3)
{
- if(cvar_settemp(argv(1), argv(2)))
+ float f = cvar_settemp(argv(1), argv(2));
+ if(f == 1)
dprint("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n");
- else
+ else if(f == -1)
dprint("Already had a tracker for ", argv(1), ", updating it to \"", argv(2), "\".\n");
-
+ // else cvar_settemp itself errors out
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2settemp^7\n");
case CMD_REQUEST_USAGE:
if not(tmp_cvar || tmp_value)
{
dprint("Error: Invalid usage of cvar_settemp(string, string); !\n");
- return FALSE;
+ return 0;
}
if(!cvar_type(tmp_cvar))
{
print(sprintf("Error: cvar %s doesn't exist!\n", tmp_cvar));
- return FALSE;
+ return 0;
}
for(e = world; (e = find(e, classname, "saved_cvar_value")); )
if(e.netname == tmp_cvar)
- 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));
- created_saved_value = TRUE;
+ created_saved_value = -1; // skip creation
- // an entity for this cvar already exists
- :saved
+ if(created_saved_value != -1)
+ {
+ // 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));
+ created_saved_value = 1;
+ }
// update the cvar to the value given
cvar_set(tmp_cvar, tmp_value);