]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixes for GetFilteredEntity, plus finish "tell" command updates
authorSamual <samual@xonotic.org>
Sat, 24 Dec 2011 22:12:32 +0000 (17:12 -0500)
committerSamual <samual@xonotic.org>
Sat, 24 Dec 2011 22:12:32 +0000 (17:12 -0500)
qcsrc/server/command/cmd.qc
qcsrc/server/command/sv_cmd.qc

index f2072db0512ac0f0dc86e551b6ce34d0f78d780a..43130b03db6b9560e55f6aa3f8b85a96bc531345 100644 (file)
@@ -461,25 +461,25 @@ void ClientCommand_tell(float request, float argc, string command)
                {
                        if(argc >= 3)
                        {
-                               if(strtolower(argv(1)) != "world")
+                               entity tell_to = GetFilteredEntity(argv(1));
+                               float tell_accepted = VerifyClientEntity(tell_to, TRUE, FALSE);
+                               
+                               if(tell_accepted > 0)
                                {
-                                       entity to = GetFilteredEntity(argv(1));
-                                       float accepted = VerifyClientEntity(to, TRUE, FALSE);
-                                       
-                                       print("accepted: ", ftos(accepted), ".\n");
-                                       
-                                       if(accepted)
+                                       if(tell_to != self)
                                        {
-                                               Say(self, FALSE, to, substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)), TRUE);
+                                               Say(self, FALSE, tell_to, substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)), TRUE);
                                                return;
                                        }
-                                       else { print_to(self, GetClientErrorString(accepted, argv(1))); }
+                                       else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
                                }
-                               else
-                               {
+                               else if(strtolower(argv(1)) == "world") 
+                               { 
+                                       print("magic ear ftw\n");
                                        trigger_magicear_processmessage_forallears(self, -1, world, substring(command, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)));
                                        return;
                                }
+                               else { print_to(self, strcat("tell: ", GetClientErrorString(tell_accepted, argv(1)), ".")); return; }
                        }
                }
                        
index f8d94f60263c8a49d2772f9f7fff05c1eed27807..7960004ae24764915cb48ca8ae35544c76ae3847 100644 (file)
@@ -120,7 +120,7 @@ void GameCommand_adminmsg(float request, float argc)
                                        client = GetFilteredEntity(t);
                                        accepted = VerifyClientEntity(client, TRUE, FALSE);
                                        
-                                       if not(accepted) 
+                                       if not(accepted > 0
                                        {
                                                print("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n")); 
                                                continue;
@@ -227,7 +227,7 @@ void GameCommand_anticheat(float request, float argc)
                        entity client = GetFilteredEntity(argv(1));
                        float accepted = VerifyClientEntity(client, FALSE, FALSE);
                        
-                       if(accepted) 
+                       if(accepted > 0
                        {
                                self = client;
                                anticheat_report();
@@ -526,7 +526,7 @@ void GameCommand_defer_clear(float request, float argc)
                                client = GetFilteredEntity(argv(1));
                                accepted = VerifyClientEntity(client, TRUE, FALSE);
                                
-                               if(accepted)
+                               if(accepted > 0)
                                {
                                        stuffcmd(client, "defer clear\n");
                                        print("defer clear stuffed to ", argv(1), " (", client.netname, ")\n");
@@ -959,7 +959,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        client = GetFilteredEntity(t);
                                        accepted = VerifyClientEntity(client, FALSE, FALSE);
                                        
-                                       if not(accepted) 
+                                       if not(accepted > 0
                                        {
                                                print("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n")); 
                                                continue;
@@ -1139,7 +1139,7 @@ void GameCommand_playerdemo(float request, float argc) // UNTESTED
                                                client = GetFilteredEntity(argv(2));
                                                accepted = VerifyClientEntity(client, FALSE, TRUE);
                                                
-                                               if not(accepted) 
+                                               if not(accepted > 0
                                                {
                                                        print("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".\n"); 
                                                        return;
@@ -1155,7 +1155,7 @@ void GameCommand_playerdemo(float request, float argc) // UNTESTED
                                                client = GetFilteredEntity(argv(2));
                                                accepted = VerifyClientEntity(client, FALSE, FALSE);
                                                
-                                               if not(accepted) 
+                                               if not(accepted > 0
                                                {
                                                        print("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".\n"); 
                                                        return;