]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/gamecommand.qc
who command is now almost fully functional :D
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / gamecommand.qc
index 977b7b3348f6d7e2b8bcf406e826f80949365851..7d24f2e5ab1614fdaa482dbbb04927704b825346 100644 (file)
@@ -1,6 +1,6 @@
 // =====================================================
 //  Server side game commands code, reworked by Samual
-//  Last updated: November 8th, 2011
+//  Last updated: December 6th, 2011
 // =====================================================
 
 #define GC_REQUEST_COMMAND 1
@@ -113,7 +113,7 @@ void modelbug()
 //  Command Sub-Functions
 // =======================
 
-void GameCommand_adminmsg(float request, float argc)
+void GameCommand_adminmsg(float request, float argc) // todo: re-write this, plus support multiple clients at once like moveplayer
 {
        switch(request)
        {
@@ -1886,7 +1886,7 @@ void GameCommand_(float request)
 // ==================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define SERVER_COMMANDS(request,arguments) \
+#define SERVER_COMMANDS(request,arguments,command) \
        SERVER_COMMAND("adminmsg", GameCommand_adminmsg(request, arguments), "Send an admin message to a client directly") \
        SERVER_COMMAND("allready", GameCommand_allready(request), "Restart the server and reset the players") \
        SERVER_COMMAND("allspec", GameCommand_allspec(request, arguments), "Force all players to spectate") \
@@ -1927,6 +1927,7 @@ void GameCommand_(float request)
        SERVER_COMMAND("trace", GameCommand_trace(request, arguments), "Various debugging tools with tracing") \
        SERVER_COMMAND("unlockteams", GameCommand_unlockteams(request), "Enable the ability for players to switch or enter teams") \
        SERVER_COMMAND("warp", GameCommand_warp(request, arguments), "Choose different level in campaign") \
+       SERVER_COMMAND("vote", VoteCommand(request, world, arguments, command), "Server side control of voting") /* handled in server/vote.qc */ \
        /* nothing */
 
 void GameCommand_macro_help()
@@ -1934,18 +1935,18 @@ void GameCommand_macro_help()
        #define SERVER_COMMAND(name,function,description) \
                { print("  ^2", name, "^7: ", description, "\n"); }
                
-       SERVER_COMMANDS(0, 0)
+       SERVER_COMMANDS(0, 0, "")
        #undef SERVER_COMMAND
        
        return;
 }
 
-float GameCommand_macro_command(float argc)
+float GameCommand_macro_command(float argc, string command)
 {
        #define SERVER_COMMAND(name,function,description) \
                { if(name == strtolower(argv(0))) { function; return TRUE; } }
                
-       SERVER_COMMANDS(GC_REQUEST_COMMAND, argc)
+       SERVER_COMMANDS(GC_REQUEST_COMMAND, argc, command)
        #undef SERVER_COMMAND
        
        return FALSE;
@@ -1956,7 +1957,7 @@ float GameCommand_macro_usage(float argc)
        #define SERVER_COMMAND(name,function,description) \
                { if(name == strtolower(argv(1))) { function; return TRUE; } }
                
-       SERVER_COMMANDS(GC_REQUEST_USAGE, argc)
+       SERVER_COMMANDS(GC_REQUEST_USAGE, argc, "")
        #undef SERVER_COMMAND
        
        return FALSE;
@@ -1978,7 +1979,7 @@ void GameCommand(string command)
                {
                        print("\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are:\n");
                        GameCommand_macro_help();
-                       GameCommand_Vote("help", world);
+                       
                        GameCommand_Ban("help");
                        GameCommand_Generic("help");
                        print("For help about specific commands, type sv_cmd help COMMAND\n");
@@ -1989,10 +1990,6 @@ void GameCommand(string command)
                        return;
                }
        } 
-       else if(GameCommand_Vote(command, world)) 
-       {
-               return; // handled by server/vote.qc 
-       }
        else if(GameCommand_Ban(command)) 
        {
                return; // handled by server/ipban.qc
@@ -2001,7 +1998,7 @@ void GameCommand(string command)
        {
                return; // handled by common/gamecommand.qc
        }
-       else if(GameCommand_macro_command(argc)) // continue as usual and scan for normal commands
+       else if(GameCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
        {
                return; // handled by one of the above GameCommand_* functions
        }