diff -r 2385edfd358b -r ed471404f531 console_cmds.c --- a/console_cmds.c Thu Jan 19 08:10:11 2006 +0000 +++ b/console_cmds.c Thu Jan 19 15:58:57 2006 +0000 @@ -365,26 +365,31 @@ uint32 index; if (argc == 0) { - IConsoleHelp("Ban a player from a network game. Usage: 'ban '"); + IConsoleHelp("Ban a player from a network game. Usage: 'ban '"); IConsoleHelp("For client-id's, see the command 'clients'"); return true; } if (argc != 2) return false; - index = atoi(argv[1]); + if (strchr(argv[1], '.') == NULL) { + index = atoi(argv[1]); + ci = NetworkFindClientFromIndex(index); + } else { + ci = NetworkFindClientFromIP(argv[1]); + index = (ci == NULL) ? 0 : ci->client_index; + } if (index == NETWORK_SERVER_INDEX) { IConsolePrint(_icolour_def, "Silly boy, you can not ban yourself!"); return true; } + if (index == 0) { IConsoleError("Invalid Client-ID"); return true; } - ci = NetworkFindClientInfoFromIndex(index); - if (ci != NULL) { uint i; /* Add user to ban-list */ @@ -407,7 +412,7 @@ uint i, index; if (argc == 0) { - IConsoleHelp("Unban a player from a network game. Usage: 'unban '"); + IConsoleHelp("Unban a player from a network game. Usage: 'unban '"); IConsoleHelp("For a list of banned IP's, see the command 'banlist'"); return true; } @@ -528,25 +533,31 @@ uint32 index; if (argc == 0) { - IConsoleHelp("Kick a player from a network game. Usage: 'kick '"); + IConsoleHelp("Kick a player from a network game. Usage: 'kick '"); IConsoleHelp("For client-id's, see the command 'clients'"); return true; } if (argc != 2) return false; - index = atoi(argv[1]); + if (strchr(argv[1], '.') == NULL) { + index = atoi(argv[1]); + ci = NetworkFindClientFromIndex(index); + } else { + ci = NetworkFindClientFromIP(argv[1]); + index = (ci == NULL) ? 0 : ci->client_index; + } + if (index == NETWORK_SERVER_INDEX) { IConsolePrint(_icolour_def, "Silly boy, you can not kick yourself!"); return true; } + if (index == 0) { IConsoleError("Invalid client-id"); return true; } - ci = NetworkFindClientInfoFromIndex(index); - if (ci != NULL) { SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED); } else