From 203216b3579c2ee41e7598eccc91e1dd2e0b487b Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 21 Feb 2018 22:26:41 +1000 Subject: [PATCH] Allow servers to define custom help messages for votes --- commands.cfg | 5 +++++ qcsrc/server/command/vote.qc | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/commands.cfg b/commands.cfg index 3baa8a5fe..79366e4b7 100644 --- a/commands.cfg +++ b/commands.cfg @@ -302,6 +302,11 @@ set sv_vote_command_restriction_movetoyellow "1;" set sv_vote_command_restriction_movetopink "1;" set sv_vote_command_restriction_movetospec "1;" +// help messages for votes that aren't implemeneted in the game code +// examples used here are based on the usage output of implemented votes +set sv_vote_command_help_restart "\nUsage:^3 vcall restart\n^7 No arguments required." +set sv_vote_command_help_gotomap "\nUsage:^3 vcall gotomap mapname\n^7 Where 'mapname' is the name of the map to go to.\n Type ^3lsmaps^7 to get a list of available maps to vote for." + // ================================= // voting - server/command/vote.qc // ================================= diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 7ed7d6b4e..6d037473d 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -1138,6 +1138,12 @@ void VoteCommand_macro_help(entity caller, float argc) VOTE_COMMANDS(CMD_REQUEST_USAGE, caller, argc, ""); #undef VOTE_COMMAND + + string cvarname = strcat("sv_vote_command_help_", argv(2)); + if(cvar_type(cvarname) & CVAR_TYPEFLAG_EXISTS) + wordwrap_sprint(caller, cvar_string(cvarname), 1000); + else + print_to(caller, "No documentation exists for this vote"); } } -- 2.39.2