Improved bot detection slightly. This was meant to go along with the fix for amb1801.
authorScott Ehlert <ds@alliedmods.net>
Sun Aug 24 04:35:48 2008 +0000 (2008-08-24)
changeset 22374403a982ec91
parent 2236 2afb085d34df
child 2238 0879e1742145
Improved bot detection slightly. This was meant to go along with the fix for amb1801.
core/PlayerManager.cpp
core/PlayerManager.h
     1.1 --- a/core/PlayerManager.cpp	Sat Aug 23 19:59:18 2008 +0000
     1.2 +++ b/core/PlayerManager.cpp	Sun Aug 24 04:35:48 2008 +0000
     1.3 @@ -451,6 +451,7 @@
     1.4  		char error[255];
     1.5  		const char *authid = engine->GetPlayerNetworkIDString(pEntity);
     1.6  		pPlayer->Authorize(authid);
     1.7 +		pPlayer->m_bFakeClient = true;
     1.8  		if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
     1.9  		{
    1.10  			/* :TODO: kick the bot if it's rejected */
    1.11 @@ -1219,6 +1220,7 @@
    1.12  	m_bIsInKickQueue = false;
    1.13  	m_LastPassword.clear();
    1.14  	m_LangId = SOURCEMOD_LANGUAGE_ENGLISH;
    1.15 +	m_bFakeClient = false;
    1.16  }
    1.17  
    1.18  void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
    1.19 @@ -1286,6 +1288,7 @@
    1.20  	m_bAdminCheckSignalled = false;
    1.21  	m_UserId = -1;
    1.22  	m_bIsInKickQueue = false;
    1.23 +	m_bFakeClient = false;
    1.24  }
    1.25  
    1.26  void CPlayer::SetName(const char *name)
    1.27 @@ -1350,7 +1353,7 @@
    1.28  
    1.29  bool CPlayer::IsFakeClient()
    1.30  {
    1.31 -	return (strncasecmp(m_AuthID.c_str(), "BOT", 3) == 0);
    1.32 +	return m_bFakeClient;
    1.33  }
    1.34  
    1.35  void CPlayer::SetAdminId(AdminId id, bool temporary)
     2.1 --- a/core/PlayerManager.h	Sat Aug 23 19:59:18 2008 +0000
     2.2 +++ b/core/PlayerManager.h	Sun Aug 24 04:35:48 2008 +0000
     2.3 @@ -195,6 +195,7 @@
     2.4  	bool m_QueryLang;
     2.5  	bool m_bIsListenServer;
     2.6  	int m_ListenClient;
     2.7 +	bool m_bFakeClient;
     2.8  };
     2.9  
    2.10  extern PlayerManager g_Players;