]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix many various things, including *ACTUALLY* fixing GetIndexedEntity
authorSamual <samual@xonotic.org>
Fri, 30 Dec 2011 06:09:12 +0000 (01:09 -0500)
committerSamual <samual@xonotic.org>
Fri, 30 Dec 2011 06:09:12 +0000 (01:09 -0500)
qcsrc/server/command/banning.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc

index 0ab9df57695cd341d114bfc0dfcaa66ac45cab8e..f3c7e6e811b3aba49754a3dca4c0dad4b1369056 100644 (file)
@@ -29,7 +29,7 @@ void BanCommand_ban(float request, float argc, string command)
                        print("Incorrect parameters for ^2ban^7\n");
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd ban address [time] reason");
+                       print("\nUsage:^3 sv_cmd ban address [time] reason\n");
                        print("  No arguments required.\n");
                        return;
                }
@@ -49,7 +49,7 @@ void BanCommand_banlist(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd banlist");
+                       print("\nUsage:^3 sv_cmd banlist\n");
                        print("  No arguments required.\n");
                        return;
                }
@@ -62,7 +62,7 @@ void BanCommand_kickban(float request, float argc, string command)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(argc >= 3)
+                       if(argc >= 2)
                        {
                                entity client = GetIndexedEntity(argc, 1);
                                float accepted = VerifyClientEntity(client, TRUE, FALSE);
@@ -75,7 +75,7 @@ void BanCommand_kickban(float request, float argc, string command)
 
                                        GET_BAN_ARG(bantime, autocvar_g_ban_default_bantime);
                                        GET_BAN_ARG(masksize, autocvar_g_ban_default_masksize);
-                                       GET_BAN_REASON(reason, "No reason provided.");
+                                       GET_BAN_REASON(reason, "No reason provided");
 
                                        Ban_KickBanClient(client, bantime, masksize, reason);
                                        
@@ -92,8 +92,8 @@ void BanCommand_kickban(float request, float argc, string command)
                        print("Incorrect parameters for ^2kickban^7\n");
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd ");
-                       print("  No arguments required.\n");
+                       print("\nUsage:^3 sv_cmd kickban client [bantime masksize reason]\n");
+                       print("  No arguments required. todo\n");
                        return;
                }
        }
@@ -117,7 +117,7 @@ void BanCommand_unban(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd unban banid");
+                       print("\nUsage:^3 sv_cmd unban banid\n");
                        print("  Where 'banid' is the ID of the ban of which to remove.\n");
                        return;
                }
@@ -139,7 +139,7 @@ void BanCommand_(float request)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd ");
+                       print("\nUsage:^3 sv_cmd \n");
                        print("  No arguments required.\n");
                        return;
                }
index efdbe95e6c31d53a63aeac12354e6295f4050d88..9fedd46bb761d1a452caadd888459cea2a83e2df 100644 (file)
@@ -503,12 +503,12 @@ void ClientCommand_tell(float request, float argc, string command)
                                
                                if(tell_accepted > 0) // the target is a real client
                                {
-                                       if(tell_to != self) // and we're allowed to send to them :D
-                                       {
+                                       //if(tell_to != self) // and we're allowed to send to them :D
+                                       //{
                                                Say(self, FALSE, tell_to, substring(command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)), TRUE);
                                                return;
-                                       }
-                                       else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
+                                       //}
+                                       //else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
                                }
                                else if(strtolower(argv(1)) == "world") 
                                { 
index 17703c7fc0ee1341733b23d3a5bf4ad288c8b738..83d5e30e6393c7ec5ee81ebf0f5533e2aa08d2c6 100644 (file)
@@ -71,7 +71,7 @@ entity GetIndexedEntity(float argc, float start_index)
                        tmp_string = substring(argv(index), 1, -1);
                        ++index;
                        
-                       if(tmp_string) // is it all one token? like #1
+                       if(tmp_string != "") // is it all one token? like #1
                        {
                                tmp_number = stof(tmp_string);
                        }
@@ -92,7 +92,7 @@ entity GetIndexedEntity(float argc, float start_index)
                        selection = edict_num(tmp_number); // yes, it was a number
                }
                else // no, maybe it's a name?
-               {                       
+               {
                        FOR_EACH_CLIENT(tmp_player)
                                if (strdecolorize(tmp_player.netname) == strdecolorize(argv(start_index)))
                                        selection = tmp_player;
@@ -102,6 +102,7 @@ entity GetIndexedEntity(float argc, float start_index)
        }
        
        next_token = index;
+       print(strcat("start_index: ", ftos(start_index), ", next_token: ", ftos(next_token), ", edict: ", ftos(num_for_edict(selection)), ".\n"));
        return selection;
 }
 
index 8cfaf3884550baafef93c10a4c996565892a55a4..0fa5667601609ab6efb1be21a435453a13aa4274 100644 (file)
@@ -493,7 +493,7 @@ void GameCommand_defer_clear(float request, float argc)
                        entity client;
                        float accepted;
                        
-                       if(argc == 2)
+                       if(argc >= 2)
                        {
                                client = GetIndexedEntity(argc, 1);
                                accepted = VerifyClientEntity(client, TRUE, FALSE);
@@ -501,7 +501,7 @@ void GameCommand_defer_clear(float request, float argc)
                                if(accepted > 0)
                                {
                                        stuffcmd(client, "defer clear\n");
-                                       print("defer clear stuffed to ", argv(1), " (", client.netname, ")\n");
+                                       print("defer clear stuffed to ", client.netname, "\n");
                                }
                                else { print("defer_clear: ", GetClientErrorString(accepted, argv(1)), ".\n"); }
                                
index 9548ab7ff98aaf9aba2a3ae2f8726fc07423e3b7..277720369bef3465542d76bb3650f97761e74885 100644 (file)
@@ -543,7 +543,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                        
                        if(accepted > 0)
                        {
-                               string reason = ((argc > next_token) ? substring(vote_command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)) : "No reason provided.");
+                               string reason = ((argc > next_token) ? substring(vote_command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)) : "No reason provided");
                                string command_arguments;
                                
                                if(first_command == "kickban")