added and tested admin authentication. WOOT. only steam-based works for now.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40466
This commit is contained in:
David Anderson
2007-02-09 04:41:03 +00:00
parent 18aabecfd3
commit 57c1f0dd4d
7 changed files with 144 additions and 11 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ void CPlayerManager::OnSourceModAllInitialized()
m_cldisconnect_post = g_Forwards.CreateForward("OnClientDisconnect_Post", ET_Ignore, 1, p2);
m_clcommand = g_Forwards.CreateForward("OnClientCommand", ET_Hook, 1, p2);
m_clinfochanged = g_Forwards.CreateForward("OnClientSettingsChanged", ET_Ignore, 1, p2);
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, p2);
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, p3);
}
void CPlayerManager::OnSourceModShutdown()
+17
View File
@@ -375,6 +375,22 @@ static cell_t GetUserFlagBits(IPluginContext *pContext, const cell_t *params)
return g_Admins.GetAdminFlags(id, Access_Effective);
}
static cell_t GetClientUserId(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Invalid client index %d.", client);
}
if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not connected.", client);
}
return engine->GetPlayerUserId(pPlayer->GetEdict());
}
REGISTER_NATIVES(playernatives)
{
{"GetMaxClients", sm_GetMaxClients},
@@ -394,6 +410,7 @@ REGISTER_NATIVES(playernatives)
{"RemoveUserFlags", RemoveUserFlags},
{"SetUserFlagBits", SetUserFlagBits},
{"GetUserFlagBits", GetUserFlagBits},
{"GetClientUserId", GetClientUserId},
{NULL, NULL}
};