]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Merge branch 'martin-t/defaults' into martin-t/okc
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index a4145abef0b10cfd658667fbadb3b6bf36600563..d1d79981182ceb91e560895f22f7f3d2e4c3a3df 100644 (file)
@@ -1,4 +1,8 @@
 #include "cmd.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 
 #include "common.qh"
@@ -101,11 +105,11 @@ void ClientCommand_clientversion(entity caller, float request, float argc)  // i
                        {
                                if (IS_CLIENT(caller))
                                {
-                                       caller.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
+                                       CS(caller).version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
 
-                                       if (caller.version < autocvar_gameversion_min || caller.version > autocvar_gameversion_max)
+                                       if (CS(caller).version < autocvar_gameversion_min || CS(caller).version > autocvar_gameversion_max)
                                        {
-                                               caller.version_mismatch = 1;
+                                               CS(caller).version_mismatch = true;
                                                ClientKill_TeamChange(caller, -2);  // observe
                                        }
                                        else if (autocvar_g_campaign || autocvar_g_balance_teams)
@@ -242,12 +246,12 @@ void ClientCommand_ready(entity caller, float request)  // todo: anti-spam for t
                                                if (caller.ready)            // toggle
                                                {
                                                        caller.ready = false;
-                                                       bprint(caller.netname, "^2 is ^1NOT^2 ready\n");
+                                                       bprint(playername(caller, false), "^2 is ^1NOT^2 ready\n");
                                                }
                                                else
                                                {
                                                        caller.ready = true;
-                                                       bprint(caller.netname, "^2 is ready\n");
+                                                       bprint(playername(caller, false), "^2 is ready\n");
                                                }
 
                                                // cannot reset the game while a timeout is active!
@@ -354,7 +358,7 @@ void ClientCommand_selectteam(entity caller, float request, float argc)
                                                                        {
                                                                                sprint(caller, "^7You already are on that team.\n");
                                                                        }
-                                                                       else if (caller.wasplayer && autocvar_g_changeteam_banned)
+                                                                       else if (CS(caller).wasplayer && autocvar_g_changeteam_banned)
                                                                        {
                                                                                sprint(caller, "^1You cannot change team, forbidden by the server.\n");
                                                                        }
@@ -537,6 +541,12 @@ void ClientCommand_tell(entity caller, float request, float argc, string command
                {
                        if (argc >= 3)
                        {
+                               if(!IS_CLIENT(caller) && IS_REAL_CLIENT(caller)) // connecting
+                               {
+                                       print_to(caller, "You can't ^2tell^7 a message while connecting.");
+                                       return;
+                               }
+
                                entity tell_to = GetIndexedEntity(argc, 1);
                                float tell_accepted = VerifyClientEntity(tell_to, true, false);