]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/sv_cmd.qc
Move most centerprints into the notifications system
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / sv_cmd.qc
index 0944f04fbbe06799f4f523d37eb243af42bddb92..282ada65122f797c4d7d0fc7ec273599624831d9 100644 (file)
@@ -106,8 +106,7 @@ void GameCommand_adminmsg(float request, float argc)
                                        }
                                        else
                                        {
-                                               centerprint(client, strcat("^3", admin_name(), ":\n^7", admin_message));
-                                               sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", admin_message, "\n"));
+                                               Send_Notification(NOTIF_ONE_ONLY, client, MSG_MULTI, MULTI_ADMINMESSAGE, admin_name(), admin_message);
                                        }
                                        
                                        successful = strcat(successful, (successful ? ", " : ""), client.netname);
@@ -435,14 +434,12 @@ void GameCommand_cointoss(float request, float argc)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       entity client;
-                       string result1 = (argv(2) ? strcat("^7", argv(1), "^3!\n") : "^1HEADS^3!\n");
-                       string result2 = (argv(2) ? strcat("^7", argv(2), "^3!\n") : "^4TAILS^3!\n");
+                       string result1 = (argv(2) ? strcat("^7", argv(1)) : "^1HEADS");
+                       string result2 = (argv(2) ? strcat("^7", argv(2)) : "^4TAILS");
                        string choice = ((random() > 0.5) ? result1 : result2);
                        
-                       FOR_EACH_CLIENT(client)
-                               centerprint(client, strcat("^3Throwing coin... Result: ", choice));
-                       bprint(strcat("^3Throwing coin... Result: ", choice));
+                       Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_COINTOSS, choice);
+                       
                        return;
                }
                
@@ -736,7 +733,12 @@ void GameCommand_gametype(float request, float argc)
                                        MapInfo_SwitchGameType(t);
                                        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
                                        if(MapInfo_count > 0)
+                                       {
+                                               // update lsmaps in case the gametype changed, this way people can easily list maps for it
+                                               if(lsmaps_reply != "") { strunzone(lsmaps_reply); }
+                                               lsmaps_reply = strzone(getlsmaps());
                                                bprint("Game type successfully switched to ", s, "\n");
+                                       }
                                        else
                                        {
                                                bprint("Cannot use this game type: no map for it found\n");
@@ -996,7 +998,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        // Where are we putting this player?
                                        if(destination == "spec" || destination == "spectator") 
                                        {
-                                               if(client.classname != "spectator" && client.classname != "observer")
+                                               if(!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        self = client;
                                                        PutObserverInServer();
@@ -1011,7 +1013,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        }
                                        else
                                        {
-                                               if(client.classname != "spectator" && client.classname != "observer")
+                                               if(!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        if(teamplay)
                                                        {
@@ -1105,7 +1107,7 @@ void GameCommand_nospectators(float request)
                        entity plr;
                        FOR_EACH_CLIENT(plr) //give every spectator <g_maxplayers_spectator_blocktime> seconds time to become a player
                        {
-                               if(plr.classname == "spectator" || plr.classname == "observer")
+                               if(IS_SPEC(plr) || IS_OBSERVER(plr))
                                {
                                        plr.spectatortime = time;
                                        Send_Notification(NOTIF_ONE_ONLY, plr, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
@@ -1588,10 +1590,10 @@ void GameCommand_trace(float request, float argc)
                                
                                case "walk":
                                {
-                                       if(argc == 3)
+                                       if(argc == 4)
                                        {
                                                e = nextent(world);
-                                               if(tracewalk(e, stov(argv(1)), e.mins, e.maxs, stov(argv(2)), MOVE_NORMAL))
+                                               if(tracewalk(e, stov(argv(2)), e.mins, e.maxs, stov(argv(3)), MOVE_NORMAL))
                                                        print("can walk\n");
                                                else
                                                        print("cannot walk\n");
@@ -1601,10 +1603,10 @@ void GameCommand_trace(float request, float argc)
                                
                                case "showline":
                                {
-                                       if(argc == 3)
+                                       if(argc == 4)
                                        {
-                                               vv = stov(argv(1));
-                                               dv = stov(argv(2));
+                                               vv = stov(argv(2));
+                                               dv = stov(argv(3));
                                                traceline(vv, dv, MOVE_NORMAL, world);
                                                trailparticles(world, particleeffectnum("TR_NEXUIZPLASMA"), vv, trace_endpos);
                                                trailparticles(world, particleeffectnum("TR_CRYLINKPLASMA"), trace_endpos, dv);
@@ -1721,7 +1723,6 @@ void GameCommand_(float request)
 // ==================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-// Common commands have double indentation to separate them a bit.
 #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") \