| 143 | } |
| 144 | |
| 145 | void CServerBan::ConBanExt(IConsole::IResult *pResult, void *pUser) |
| 146 | { |
| 147 | CServerBan *pThis = static_cast<CServerBan *>(pUser); |
| 148 | |
| 149 | const char *pStr = pResult->GetString(0); |
| 150 | int Minutes = pResult->NumArguments() > 1 ? std::clamp(pResult->GetInteger(1), 0, 525600) : 10; |
| 151 | const char *pReason = pResult->NumArguments() > 2 ? pResult->GetString(2) : "Follow the server rules. Type /rules into the chat."; |
| 152 | |
| 153 | if(str_isallnum(pStr)) |
| 154 | { |
| 155 | int ClientId = str_toint(pStr); |
| 156 | if(ClientId < 0 || ClientId >= MAX_CLIENTS || pThis->Server()->m_aClients[ClientId].m_State == CServer::CClient::STATE_EMPTY) |
| 157 | pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "net_ban", "ban error (invalid client id)"); |
| 158 | else |
| 159 | pThis->BanAddr(pThis->Server()->ClientAddr(ClientId), Minutes * 60, pReason, false); |
| 160 | } |
| 161 | else |
| 162 | ConBan(pResult, pUser); |
| 163 | } |
| 164 | |
| 165 | void CServerBan::ConBanRegion(IConsole::IResult *pResult, void *pUser) |
| 166 | { |
nothing calls this directly
no test coverage detected