From: Samual Date: Fri, 30 Dec 2011 06:09:12 +0000 (-0500) Subject: Fix many various things, including *ACTUALLY* fixing GetIndexedEntity X-Git-Tag: xonotic-v0.6.0~188^2~28^2~20 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5c22b5d77a38fcb7467edac029d3911ecc5296a7;p=xonotic%2Fxonotic-data.pk3dir.git Fix many various things, including *ACTUALLY* fixing GetIndexedEntity --- diff --git a/qcsrc/server/command/banning.qc b/qcsrc/server/command/banning.qc index 0ab9df576..f3c7e6e81 100644 --- a/qcsrc/server/command/banning.qc +++ b/qcsrc/server/command/banning.qc @@ -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; } diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index efdbe95e6..9fedd46bb 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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") { diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 17703c7fc..83d5e30e6 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -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; } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 8cfaf3884..0fa566760 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -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"); } diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 9548ab7ff..277720369 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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")