float vote_selection;
string vote_string;
- switch(argv(1))
+ if(InterpretBoolean(argv(1)))
+ {
+ vote_selection = 2;
+ vote_string = "yes";
+ }
+ else
{
- case "yes": vote_selection = 2; vote_string = "yes"; break;
- case "no": vote_selection = 1; vote_string = "no"; break;
- default: break;
+ vote_selection = 1;
+ vote_string = "no";
}
if(vote_selection)
}
}
-void LocalCommand_hud(float request, float argc) // TODO: Add aliases in commands.cfg
+void LocalCommand_hud(float request, float argc)
{
switch(request)
{
case "scoreboard_columns_set":
{
Cmd_HUD_SetFields(argc);
-
return;
}
case "scoreboard_columns_help":
{
Cmd_HUD_Help();
-
return;
}
case "radar":
{
- if(argv(2))
- hud_panel_radar_maximized = (stof(argv(2)) != 0);
- else
- hud_panel_radar_maximized = !hud_panel_radar_maximized;
-
+ hud_panel_radar_maximized = (argv(2) ? InterpretBoolean(argv(2)) : !hud_panel_radar_maximized);
return;
}
}
case CMD_REQUEST_COMMAND:
{
Cmd_MapVote_MapDownload(argc);
-
return;
}
localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n");
strunzone(thiscvar);
-
return;
}
{
case CMD_REQUEST_COMMAND:
{
- if((argv(1) == "restore") && (argc == 2))
+ if((argv(1) == "restore") && argv(2))
{
float i = cvar_clientsettemp_restore();
print("Incorrect parameters for ^2settemp^7\n");
case CMD_REQUEST_USAGE:
{
- print("\nUsage:^3 cl_cmd settemp <cvar> | [restore]\n");
+ print("\nUsage:^3 cl_cmd settemp \"cvar\" | [restore]\n");
print(" Where 'cvar' is the cvar plus arguments to send to the server,\n");
print(" or 'restore' allows you to restore all of the original temporary cvar values.\n");
return;
input = strreplace("\"", "\\\"", input);
return input;
}
+
+#ifndef MENUQC
+// get true/false value of a string with multiple different inputs
+float InterpretBoolean(string input)
+{
+ switch(strtolower(input))
+ {
+ case "yes":
+ case "true":
+ case "on":
+ return TRUE;
+
+ case "no":
+ case "false":
+ case "off":
+ return FALSE;
+
+ default: return stof(input);
+ }
+}
+#endif
\ No newline at end of file