| 2018 | } |
| 2019 | |
| 2020 | static bool ConSayClient(std::span<std::string_view> argv) |
| 2021 | { |
| 2022 | if (argv.empty()) { |
| 2023 | IConsolePrint(CC_HELP, "Chat to a certain client in a multiplayer game. Usage: 'say_client <client-id> \"<msg>\"'."); |
| 2024 | IConsolePrint(CC_HELP, "For client-id's, see the command 'clients'."); |
| 2025 | return true; |
| 2026 | } |
| 2027 | |
| 2028 | if (argv.size() != 3) return false; |
| 2029 | |
| 2030 | auto client_id = ParseType<ClientID>(argv[1]); |
| 2031 | if (!client_id.has_value()) { |
| 2032 | IConsolePrint(CC_ERROR, "The given client-id is not a valid number."); |
| 2033 | return true; |
| 2034 | } |
| 2035 | |
| 2036 | if (!_network_server) { |
| 2037 | NetworkClientSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, *client_id, argv[2]); |
| 2038 | } else { |
| 2039 | bool from_admin = (_redirect_console_to_admin < AdminID::Invalid()); |
| 2040 | NetworkServerSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, *client_id, argv[2], CLIENT_ID_SERVER, from_admin); |
| 2041 | } |
| 2042 | |
| 2043 | return true; |
| 2044 | } |
| 2045 | |
| 2046 | /** All the known authorized keys with their name. */ |
| 2047 | static const std::initializer_list<std::pair<std::string_view, NetworkAuthorizedKeys *>> _console_cmd_authorized_keys{ |
nothing calls this directly
no test coverage detected