diff options
author | rubidium <rubidium@openttd.org> | 2009-01-21 23:07:11 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-21 23:07:11 +0000 |
commit | f2777cd02d06cbc88a6b168feec3354e45d1bdea (patch) | |
tree | 5d6f9b8b5093af32d97cae67f8ff82af91a50f66 /src/console_cmds.cpp | |
parent | 0fa6e050e4aa23c0cceac6f424ac2d9b7f554db3 (diff) | |
download | openttd-f2777cd02d06cbc88a6b168feec3354e45d1bdea.tar.xz |
(svn r15200) -Feature: give server admins a tool to combat profanity in nick names (based on patch by dihedral)
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r-- | src/console_cmds.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 2d104be47..e7b262450 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -555,6 +555,33 @@ DEF_CONSOLE_CMD(ConServerInfo) return true; } +DEF_CONSOLE_CMD(ConClientNickChange) +{ + if (argc != 3) { + IConsoleHelp("Change the nickname of a connected client. Usage: 'client_name <client-id> <new-name>'"); + IConsoleHelp("For client-id's, see the command 'clients'"); + return true; + } + + ClientID client_id = (ClientID)atoi(argv[1]); + + if (client_id == CLIENT_ID_SERVER) { + IConsoleError("Please use the command 'name' to change your own name!"); + return true; + } + + if (NetworkFindClientInfoFromClientID(client_id) == NULL) { + IConsoleError("Invalid client"); + return true; + } + + if (!NetworkServerChangeClientName(client_id, argv[2])) { + IConsoleError("Cannot give a client a duplicate name"); + } + + return true; +} + DEF_CONSOLE_CMD(ConKick) { NetworkClientInfo *ci; @@ -1690,6 +1717,8 @@ void IConsoleStdLibRegister() IConsoleCmdRegister("reset_company", ConResetCompany); IConsoleCmdHookAdd("reset_company", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); IConsoleAliasRegister("clean_company", "reset_company %A"); + IConsoleCmdRegister("client_name", ConClientNickChange); + IConsoleCmdHookAdd("client_name", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); IConsoleCmdRegister("kick", ConKick); IConsoleCmdHookAdd("kick", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); IConsoleCmdRegister("ban", ConBan); |