fixed mute evasion + kick

This commit is contained in:
GreYFoXGTi 2010-12-19 07:25:01 +02:00
parent 08a2f47ee8
commit 63961ecf1a
3 changed files with 10 additions and 7 deletions

View file

@ -1865,3 +1865,8 @@ char *CServer::GetAnnouncementLine(char const *FileName)
} }
return 0; return 0;
} }
NETADDR CServer::GetClientIP(int ClientID)//this may exist already but i couldn't find it cause i am tired :D
{
return m_NetServer.ClientAddr(ClientID);
}

View file

@ -158,6 +158,7 @@ public:
int IsAuthed(int ClientID); int IsAuthed(int ClientID);
int GetClientInfo(int ClientID, CClientInfo *pInfo); int GetClientInfo(int ClientID, CClientInfo *pInfo);
void GetClientIP(int ClientID, char *pIPString, int Size); void GetClientIP(int ClientID, char *pIPString, int Size);
NETADDR GetClientIP(int ClientID);
const char *ClientName(int ClientId); const char *ClientName(int ClientId);
bool ClientIngame(int ClientID); bool ClientIngame(int ClientID);

View file

@ -135,15 +135,12 @@ void CPlayer::OnDisconnect()
{ {
char aBuf[512]; char aBuf[512];
str_format(aBuf, sizeof(aBuf), "'%s' has left the game", Server()->ClientName(m_ClientID)); str_format(aBuf, sizeof(aBuf), "'%s' has left the game", Server()->ClientName(m_ClientID));
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
char Cmd[64];
str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID)); str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID));
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf); GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf);
char aIp[24]; if(m_Muted > 0)
Server()->GetClientIP(m_ClientID, aIp, sizeof(aIp)); {
if(m_Muted > 0) { ((CServer *)Server())->BanAdd(((CServer *)Server())->GetClientIP(m_ClientID), ((m_Muted/Server()->TickSpeed())+1), "Mute evasion");
str_format(Cmd, sizeof(Cmd), "ban %s %d %s", aIp, (m_Muted/Server()->TickSpeed()/60)+1, "Mute evasion"); return;
GameServer()->Console()->ExecuteLine(Cmd, 3, -1);
} }
} }
} }