NoSteamManager: start filling the anti-spoofing database
This commit is contained in:
parent
fea517607e
commit
17b3ee0255
@ -11,7 +11,8 @@ ConVar g_hCvar_BlockAdmin;
|
|||||||
ConVar g_hCvar_BlockVoice;
|
ConVar g_hCvar_BlockVoice;
|
||||||
|
|
||||||
/* DATABASE */
|
/* DATABASE */
|
||||||
Database g_hDatabase;
|
Database g_hDatabaseSB;
|
||||||
|
Database g_hDatabaseAntiSpoofing;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -41,15 +42,18 @@ public void OnPluginStart()
|
|||||||
AutoExecConfig();
|
AutoExecConfig();
|
||||||
|
|
||||||
char sError[256];
|
char sError[256];
|
||||||
if (SQL_CheckConfig("sourcebans"))
|
|
||||||
{
|
|
||||||
g_hDatabase = SQL_Connect("sourcebans", true, sError, sizeof(sError));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_hDatabase == null)
|
if (SQL_CheckConfig("sourcebans"))
|
||||||
{
|
g_hDatabaseSB = SQL_Connect("sourcebans", true, sError, sizeof(sError));
|
||||||
|
|
||||||
|
if (g_hDatabaseSB == null)
|
||||||
|
LogError("Could not connect to database: %s", sError);
|
||||||
|
|
||||||
|
if (SQL_CheckConfig("antispoofing"))
|
||||||
|
g_hDatabaseAntiSpoofing = SQL_Connect("antispoofing", true, sError, sizeof(sError));
|
||||||
|
|
||||||
|
if (g_hDatabaseAntiSpoofing == null)
|
||||||
LogError("Could not connect to database: %s", sError);
|
LogError("Could not connect to database: %s", sError);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -155,10 +159,22 @@ public Action OnClientPreAdminCheck(int client)
|
|||||||
|
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
Format(sQuery, sizeof(sQuery), "SELECT * from sb_admins WHERE authid = '%s'", sSteamID);
|
Format(sQuery, sizeof(sQuery), "SELECT * from sb_admins WHERE authid = '%s'", sSteamID);
|
||||||
SQL_TQuery(g_hDatabase, TQueryCB, sQuery, GetClientUserId(client));
|
SQL_TQuery(g_hDatabaseSB, TQueryCB, sQuery, GetClientUserId(client));
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char sIP[32];
|
||||||
|
GetClientIP(client, sIP, sizeof(sIP));
|
||||||
|
|
||||||
|
int iTimestamp = GetTime();
|
||||||
|
|
||||||
|
char sQuery[512];
|
||||||
|
Format(sQuery, sizeof(sQuery), "INSERT INTO authenticated_steam_ids (steam_auth, last_ip, last_connect) VALUES ('%s', '%s', %d) ON DUPLICATE KEY UPDATE last_ip = '%s';", sSteamID, sIP, iTimestamp, sIP);
|
||||||
|
SQL_TQuery(g_hDatabaseAntiSpoofing, TQueryCB2, sQuery, GetClientUserId(client));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
@ -200,4 +216,12 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
|||||||
LogMessage("%L tried to join with an Admin-SteamID while not being authentiated with steam.", client);
|
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.");
|
KickClient(client, "Trying to join with an Admin-SteamID while not being authentiated with steam.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void TQueryCB2(Handle owner, Handle rs, const char[] error, any data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user