core/PlayerManager.cpp
changeset 1160 7d8b449edd60
parent 978 54782a83a1ef
child 1161 b122ca4464ec
     1.1 --- a/core/PlayerManager.cpp	Tue Jul 24 15:07:38 2007 +0000
     1.2 +++ b/core/PlayerManager.cpp	Tue Jul 24 17:05:46 2007 +0000
     1.3 @@ -98,6 +98,23 @@
     1.4  	delete [] m_Players;
     1.5  }
     1.6  
     1.7 +ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key, 
     1.8 +												 const char *value, 
     1.9 +												 ConfigSource source, 
    1.10 +												 char *error, 
    1.11 +												 size_t maxlength)
    1.12 +{
    1.13 +	if (strcmp(key, "PassInfoVar") == 0)
    1.14 +	{
    1.15 +		if (strcmp(value, "_password") != 0)
    1.16 +		{
    1.17 +			m_PassInfoVar.assign(value);
    1.18 +		}
    1.19 +		return ConfigResult_Accept;
    1.20 +	}
    1.21 +	return ConfigResult_Ignore;
    1.22 +}
    1.23 +
    1.24  void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
    1.25  {
    1.26  	if (m_FirstPass)
    1.27 @@ -119,13 +136,18 @@
    1.28  	SM_ExecuteAllConfigs();
    1.29  }
    1.30  
    1.31 -bool CheckSetAdmin(int index, CPlayer *pPlayer, AdminId id)
    1.32 +bool PlayerManager::CheckSetAdmin(int index, CPlayer *pPlayer, AdminId id)
    1.33  {
    1.34  	const char *password = g_Admins.GetAdminPassword(id);
    1.35  	if (password != NULL)
    1.36  	{
    1.37 +		if (m_PassInfoVar.size() < 1)
    1.38 +		{
    1.39 +			return false;
    1.40 +		}
    1.41 +
    1.42  		/* Whoa... the user needs a password! */
    1.43 -		const char *given = engine->GetClientConVarValue(index, "_password");
    1.44 +		const char *given = engine->GetClientConVarValue(index, m_PassInfoVar.c_str());
    1.45  		if (!given || strcmp(given, password) != 0)
    1.46  		{
    1.47  			return false;