NoSteamManager: autokick for non-Steamers with an Admin-SteamID
This commit is contained in:
parent
d7d730d6c3
commit
fea517607e
@ -10,6 +10,9 @@
|
||||
ConVar g_hCvar_BlockAdmin;
|
||||
ConVar g_hCvar_BlockVoice;
|
||||
|
||||
/* DATABASE */
|
||||
Database g_hDatabase;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -36,6 +39,17 @@ public void OnPluginStart()
|
||||
RegConsoleCmd("sm_steam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players");
|
||||
|
||||
AutoExecConfig();
|
||||
|
||||
char sError[256];
|
||||
if (SQL_CheckConfig("sourcebans"))
|
||||
{
|
||||
g_hDatabase = SQL_Connect("sourcebans", true, sError, sizeof(sError));
|
||||
}
|
||||
|
||||
if (g_hDatabase == null)
|
||||
{
|
||||
LogError("Could not connect to database: %s", sError);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -139,6 +153,10 @@ public Action OnClientPreAdminCheck(int client)
|
||||
LogMessage("%L was not authenticated with steam, denying admin.", client);
|
||||
NotifyPostAdminCheck(client);
|
||||
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "SELECT * from sb_admins WHERE authid = '%s'", sSteamID);
|
||||
SQL_TQuery(g_hDatabase, TQueryCB, sQuery, GetClientUserId(client));
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -163,7 +181,23 @@ public void OnClientPostAdminCheck(int client)
|
||||
{
|
||||
LogMessage("%L was not authenticated with steam, muting client.", client);
|
||||
BaseComm_SetClientMute(client, true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
||||
{
|
||||
int client = 0;
|
||||
|
||||
if ((client = GetClientOfUserId(data)) == 0)
|
||||
return;
|
||||
|
||||
if (SQL_GetRowCount(rs) > 0)
|
||||
{
|
||||
LogMessage("%L tried to join with an Admin-SteamID while not being authentiated with steam.", client);
|
||||
KickClient(client, "Trying to join with an Admin-SteamID while not being authentiated with steam.");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user