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:
@@ -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()
|
||||
|
||||
@@ -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}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user