]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow servers to define custom help messages for votes
authorMario <mario@smbclan.net>
Wed, 21 Feb 2018 12:26:41 +0000 (22:26 +1000)
committerMario <mario@smbclan.net>
Wed, 21 Feb 2018 12:26:41 +0000 (22:26 +1000)
commands.cfg
qcsrc/server/command/vote.qc

index 3baa8a5fe0cec6bd0ba867df201ac10a4d9c429a..79366e4b703af1967b2ef20e8a1299536d4d9974 100644 (file)
@@ -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
 // =================================
index 7ed7d6b4eae3435478c111dde86799b25afdf77a..6d037473dd39907726f7eca7615610838f6b4f19 100644 (file)
@@ -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");
        }
 }