added amb403 (sm_reloadadmins)

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401168
This commit is contained in:
David Anderson 2007-07-24 22:20:58 +00:00
parent 48d71cae26
commit 39f7d51747
4 changed files with 27 additions and 0 deletions

View File

@ -831,6 +831,7 @@ void AdminCache::DumpAdminCache(AdminCachePart part, bool rebuild)
m_pCacheFwd->PushCell(AdminCache_Admins); m_pCacheFwd->PushCell(AdminCache_Admins);
m_pCacheFwd->Execute(&result); m_pCacheFwd->Execute(&result);
} }
g_Players.RecheckAnyAdmins();
} }
} }

View File

@ -708,6 +708,18 @@ const char *PlayerManager::GetPassInfoVar()
return m_PassInfoVar.c_str(); return m_PassInfoVar.c_str();
} }
void PlayerManager::RecheckAnyAdmins()
{
for (int i=1; i<=m_maxClients; i++)
{
if (m_Players[i].IsInGame() && m_Players[i].IsAuthorized())
{
m_Players[i].DoBasicAdminChecks();
}
}
}
/******************* /*******************
*** PLAYER CODE *** *** PLAYER CODE ***
*******************/ *******************/

View File

@ -116,6 +116,7 @@ public:
bool CheckSetAdmin(int index, CPlayer *pPlayer, AdminId id); bool CheckSetAdmin(int index, CPlayer *pPlayer, AdminId id);
bool CheckSetAdminName(int index, CPlayer *pPlayer, AdminId id); bool CheckSetAdminName(int index, CPlayer *pPlayer, AdminId id);
const char *GetPassInfoVar(); const char *GetPassInfoVar();
void RecheckAnyAdmins();
private: private:
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax); void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
private: private:

View File

@ -51,12 +51,25 @@ public OnPluginStart()
RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban <steamid>"); RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban <steamid>");
RegAdminCmd("sm_addban", Command_AddBan, ADMFLAG_RCON, "sm_addban <time> <steamid> [reason]"); RegAdminCmd("sm_addban", Command_AddBan, ADMFLAG_RCON, "sm_addban <time> <steamid> [reason]");
RegAdminCmd("sm_banip", Command_BanIp, ADMFLAG_RCON, "sm_banip <time> <ip> [reason]"); RegAdminCmd("sm_banip", Command_BanIp, ADMFLAG_RCON, "sm_banip <time> <ip> [reason]");
RegAdminCmd("sm_reloadadmins", Command_ReloadAdmins, ADMFLAG_BAN, "sm_reloadadmins");
hBanForward = CreateGlobalForward("OnClientBanned", ET_Hook, Param_Cell, Param_Cell, Param_Cell, Param_String); hBanForward = CreateGlobalForward("OnClientBanned", ET_Hook, Param_Cell, Param_Cell, Param_Cell, Param_String);
hAddBanForward = CreateGlobalForward("OnBanAdded", ET_Hook, Param_Cell, Param_String, Param_Cell, Param_String); hAddBanForward = CreateGlobalForward("OnBanAdded", ET_Hook, Param_Cell, Param_String, Param_Cell, Param_String);
hBanRemoved = CreateGlobalForward("OnBanRemoved", ET_Hook, Param_Cell, Param_String); hBanRemoved = CreateGlobalForward("OnBanRemoved", ET_Hook, Param_Cell, Param_String);
} }
public Action:Command_ReloadAdmins(client, args)
{
/* Dump it all! */
DumpAdminCache(AdminCache_Groups, true);
DumpAdminCache(AdminCache_Overrides, true);
LogMessage("\"%L\" refreshed the admin cache.", client);
ReplyToCommand(client, "[SM] %t", "Admin cache refreshed");
return Plugin_Handled;
}
public Action:Command_BanIp(client, args) public Action:Command_BanIp(client, args)
{ {
if (args < 2) if (args < 2)