diff --git a/src/engine/server.h b/src/engine/server.h index 3f4125478..9f2f25f0f 100644 --- a/src/engine/server.h +++ b/src/engine/server.h @@ -167,6 +167,8 @@ public: virtual int GetAuthedState(int ClientID) = 0; virtual const char *GetAuthName(int ClientID) = 0; virtual void Kick(int ClientID, const char *pReason) = 0; + virtual void Ban(int ClientID, int seconds, const char *pReason) = 0; + virtual void DemoRecorder_HandleAutoStart() = 0; virtual bool DemoRecorder_IsRecording() = 0; diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index f8567aa5c..ded127146 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -428,6 +428,13 @@ void CServer::Kick(int ClientID, const char *pReason) m_NetServer.Drop(ClientID, pReason); } +void CServer::Ban(int ClientID, int seconds, const char *pReason) +{ + NETADDR Addr; + GetClientAddr(ClientID, &Addr); + m_NetServer.NetBan()->BanAddr(&Addr, seconds, pReason); +} + /*int CServer::Tick() { return m_CurrentGameTick; diff --git a/src/engine/server/server.h b/src/engine/server/server.h index bce48a96e..8703404ac 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -238,6 +238,7 @@ public: virtual void SetClientScore(int ClientID, int Score); void Kick(int ClientID, const char *pReason); + void Ban(int ClientID, int seconds, const char *pReason); void DemoRecorder_HandleAutoStart(); bool DemoRecorder_IsRecording(); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index abc4dc0dc..5ddad8690 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -1804,13 +1804,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) if(g_Config.m_SvBotVersionNumbers != '\0' && IsBotVersion(Version)) { if(g_Config.m_SvBotPunishment) - { - char aBuf[128]; - NETADDR Addr; - Server()->GetClientAddr(ClientID, &Addr); - str_format(aBuf, sizeof(aBuf), "ban %d %d %s", ClientID, g_Config.m_SvBotPunishment, "bot client"); - Console()->ExecuteLine(aBuf); - } + Server()->Ban(ClientID, g_Config.m_SvBotPunishment * 60, "bot client"); else Server()->Kick(ClientID, "bot client"); }