diff options
| author | Teetime <anton.tsoulos@yahoo.de> | 2011-10-22 20:02:41 +0200 |
|---|---|---|
| committer | Teetime <anton.tsoulos@yahoo.de> | 2011-10-22 20:02:41 +0200 |
| commit | 22dc341f791627ceead61d0d31d06ce1b1edbff8 (patch) | |
| tree | 84b181c7b009971f7e0e65fcc94cad353afc1f54 /src/game/server/gamecontext.cpp | |
| parent | 505c0606ea7c93f0440394131722a31e6c1bcfe9 (diff) | |
| download | zcatch-22dc341f791627ceead61d0d31d06ce1b1edbff8.tar.gz zcatch-22dc341f791627ceead61d0d31d06ce1b1edbff8.zip | |
added automated mute on spamming
Diffstat (limited to 'src/game/server/gamecontext.cpp')
| -rw-r--r-- | src/game/server/gamecontext.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 7b651486..a22f2415 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -690,6 +690,25 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) *pMessage = ' '; pMessage++; } + + //Check if the player is muted + char aAddrStr[NETADDR_MAXSTRSIZE] = {0}; + Server()->GetClientAddr(ClientID, aAddrStr, sizeof(aAddrStr)); + int Pos; + if((Pos = Muted(aAddrStr)) > -1) + { + char aBuf[128]; + int Expires = (m_aMutes[Pos].m_Expires - Server()->Tick())/Server()->TickSpeed(); + str_format(aBuf, sizeof(aBuf), "You are muted for %d minutes and %d seconds.", Expires/60, Expires%60); + SendChatTarget(ClientID, aBuf); + return; + } + else if((pPlayer->m_ChatTicks += g_Config.m_SvChatValue) > g_Config.m_SvChatThreshold) //is he spamming? + { + AddMute(ClientID, 60); + pPlayer->m_ChatTicks = 0; + return; + } /* begin zCatch*/ if(!str_comp("/info", pMsg->m_pMessage) || !str_comp("/about", pMsg->m_pMessage)) @@ -728,20 +747,8 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) else if(!str_comp_num("/", pMsg->m_pMessage, 1)) SendChatTarget(ClientID, "Unknown command."); else - { - char aAddrStr[NETADDR_MAXSTRSIZE] = {0}; - Server()->GetClientAddr(ClientID, aAddrStr, sizeof(aAddrStr)); - int Pos = Muted(aAddrStr); - if(Pos > -1) - { - char aBuf[128]; - int Expires = (m_aMutes[Pos].m_Expires - Server()->Tick())/Server()->TickSpeed(); - str_format(aBuf, sizeof(aBuf), "You are muted for %d minutes and %d seconds.", Expires/60, Expires%60); - SendChatTarget(ClientID, aBuf); - return; - } SendChat(ClientID, Team, pMsg->m_pMessage); - } + /* end zCatch */ } else if(MsgID == NETMSGTYPE_CL_CALLVOTE) |