From: Mario Date: Wed, 21 Feb 2018 12:26:41 +0000 (+1000) Subject: Allow servers to define custom help messages for votes X-Git-Tag: xonotic-v0.8.5~2286 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=203216b3579c2ee41e7598eccc91e1dd2e0b487b;p=xonotic%2Fxonotic-data.pk3dir.git Allow servers to define custom help messages for votes --- 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"); } }