1.1 --- a/core/PlayerManager.cpp Sat Mar 17 20:25:08 2007 +0000
1.2 +++ b/core/PlayerManager.cpp Sat Mar 17 23:03:44 2007 +0000
1.3 @@ -196,8 +196,11 @@
1.4
1.5 if (res)
1.6 {
1.7 - m_AuthQueue[++m_AuthQueue[0]] = client;
1.8 - g_SourceMod.SetAuthChecking(true);
1.9 + if (!m_Players[client].IsAuthorized())
1.10 + {
1.11 + m_AuthQueue[++m_AuthQueue[0]] = client;
1.12 + g_SourceMod.SetAuthChecking(true);
1.13 + }
1.14 } else {
1.15 RETURN_META_VALUE(MRES_SUPERCEDE, false);
1.16 }
1.17 @@ -229,10 +232,13 @@
1.18 int client = engine->IndexOfEdict(pEntity);
1.19
1.20 CPlayer *pPlayer = GetPlayerByIndex(client);
1.21 + /* If they're not connected, they're a bot */
1.22 if (!pPlayer->IsConnected())
1.23 {
1.24 /* Run manual connection routines */
1.25 char error[255];
1.26 + const char *authid = engine->GetPlayerNetworkIDString(pEntity);
1.27 + pPlayer->Authorize(authid);
1.28 if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
1.29 {
1.30 /* :TODO: kick the bot if it's rejected */
1.31 @@ -244,7 +250,35 @@
1.32 {
1.33 pListener = (*iter);
1.34 pListener->OnClientConnected(client);
1.35 + /* See if bot was kicked */
1.36 + if (!pPlayer->IsConnected())
1.37 + {
1.38 + return;
1.39 + }
1.40 }
1.41 + /* Now do authorization */
1.42 + for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
1.43 + {
1.44 + pListener = (*iter);
1.45 + pListener->OnClientAuthorized(client, authid);
1.46 + /* See if bot was kicked */
1.47 + if (!pPlayer->IsConnected())
1.48 + {
1.49 + return;
1.50 + }
1.51 + }
1.52 + /* Finally, tell plugins */
1.53 + if (m_clauth->GetFunctionCount())
1.54 + {
1.55 + m_clauth->PushCell(client);
1.56 + m_clauth->PushString(authid);
1.57 + m_clauth->Execute(NULL);
1.58 + }
1.59 + }
1.60 +
1.61 + if (playerinfo)
1.62 + {
1.63 + pPlayer->m_Info = playerinfo->GetPlayerInfo(pEntity);
1.64 }
1.65
1.66 List<IClientListener *>::iterator iter;
1.67 @@ -253,6 +287,11 @@
1.68 {
1.69 pListener = (*iter);
1.70 pListener->OnClientPutInServer(client);
1.71 + /* See if player was kicked */
1.72 + if (!pPlayer->IsConnected())
1.73 + {
1.74 + return;
1.75 + }
1.76 }
1.77
1.78 m_Players[client].Connect();
1.79 @@ -432,6 +471,7 @@
1.80 m_pEdict = NULL;
1.81 m_Admin = INVALID_ADMIN_ID;
1.82 m_TempAdmin = false;
1.83 + m_Info = NULL;
1.84 }
1.85
1.86 void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
1.87 @@ -463,6 +503,7 @@
1.88 m_Ip.clear();
1.89 m_AuthID.clear();
1.90 m_pEdict = NULL;
1.91 + m_Info = NULL;
1.92 }
1.93
1.94 void CPlayer::SetName(const char *name)
1.95 @@ -505,6 +546,11 @@
1.96 return m_IsAuthorized;
1.97 }
1.98
1.99 +IPlayerInfo *CPlayer::GetPlayerInfo()
1.100 +{
1.101 + return m_Info;
1.102 +}
1.103 +
1.104 bool CPlayer::IsFakeClient()
1.105 {
1.106 return (strcmp(m_AuthID.c_str(), "BOT") == 0);