From: Samual Date: Sun, 24 Jul 2011 22:04:24 +0000 (-0400) Subject: Simple updates plus "sv_info_" command for retrieving information created by server... X-Git-Tag: xonotic-v0.6.0~188^2~28^2~277 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ca4f32f5031cf3c83ca280f54bd190c1016ae777;p=xonotic%2Fxonotic-data.pk3dir.git Simple updates plus "sv_info_" command for retrieving information created by server admin --- diff --git a/qcsrc/server/clientcommands.qc b/qcsrc/server/clientcommands.qc index 2a738e4d4..1722c7049 100644 --- a/qcsrc/server/clientcommands.qc +++ b/qcsrc/server/clientcommands.qc @@ -27,7 +27,7 @@ void ReadyCount(); float SV_ParseClientCommand_floodcheck() { - if (timeoutStatus != 2) // why? + if (timeoutStatus != 2) // if the game is not paused... but wait, doesn't that mean it could be dos'd by pausing it? eh? (old code) { if(time == self.cmd_floodtime) // todo: add buffer time as well, ONLY one second is a short amount of time for someone to be spamming. { @@ -411,7 +411,7 @@ void ClientCommand_cvar_changes(float request, entity client) case CC_REQUEST_COMMAND: sprint(client, cvar_changes); - return; + return; // never fall through to usage default: case CC_REQUEST_USAGE: @@ -432,7 +432,7 @@ void ClientCommand_cvar_purechanges(float request, entity client) case CC_REQUEST_COMMAND: sprint(client, cvar_purechanges); - return; + return; // never fall through to usage default: case CC_REQUEST_USAGE: @@ -443,6 +443,32 @@ void ClientCommand_cvar_purechanges(float request, entity client) } } +void ClientCommand_info(float request, entity client, float argc) +{ + string command; + + switch(request) + { + case CC_REQUEST_HELP: + sprint(client, " ^2info^7: Request for unique server information set up by admin\n"); + return; + + case CC_REQUEST_COMMAND: + command = cvar_string_builtin(strcat("sv_info_", argv(1))); + if(command) + wordwrap_sprint(command, 1111); // why 1111? + else + sprint(client, "ERROR: unsupported info command\n"); + return; // never fall through to usage + + default: + case CC_REQUEST_USAGE: + sprint(client, "\nUsage:^3 cmd info request\n"); + sprint(client, " Where 'request' is the suffixed string appended onto the request for cvar.\n"); + return; + } +} + // ====================================== // Main Function Called By Engine (cmd) @@ -483,6 +509,7 @@ void SV_ParseClientCommand(string command) clientCommand_clientversion(CC_REQUEST_HELP, self, 0); ClientCommand_cvar_changes(CC_REQUEST_HELP, self); ClientCommand_cvar_purechanges(CC_REQUEST_HELP, self); + ClientCommand_info(CC_REQUEST_HELP, self, 0); sprint(self, "For help about specific commands, type cmd help COMMAND\n"); return; } @@ -514,6 +541,7 @@ void SV_ParseClientCommand(string command) case "clientversion": ClientCommand_clientversion(search_request_type, self, argc); break; case "cvar_changes": ClientCommand_cvar_changes(search_request_type, self); break; case "cvar_purechanges": ClientCommand_cvar_purechanges(search_request_type, self); break; + case "info": ClientCommand_info(search_request_type, self, argc); break; default: clientcommand(self, command); //print("Invalid command. For a list of supported commands, try cmd help.\n");