NoSteamManager: Potentially block steamid spoofs.
Block no-steamers from joining whenever the 'owner' of the steamid is connected, or kick them whenever the 'owner' is connecting.
This commit is contained in:
parent
6b37afd8de
commit
0c8697438b
@ -9,6 +9,7 @@
|
||||
/* CONVARS */
|
||||
ConVar g_hCvar_BlockAdmin;
|
||||
ConVar g_hCvar_BlockVoice;
|
||||
ConVar g_hCvar_BlockSpoof;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -28,6 +29,7 @@ public void OnPluginStart()
|
||||
{
|
||||
g_hCvar_BlockAdmin = CreateConVar("sm_nosteam_block_admin", "1", "Should people marked as nosteam be blocked from admin?", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
g_hCvar_BlockVoice = CreateConVar("sm_nosteam_block_voice", "1", "Should people marked as nosteam be blocked from voice?", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
g_hCvar_BlockSpoof = CreateConVar("sm_nosteam_block_spoof", "1", "Block nosteam people being able to spoof steamids.", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
|
||||
AddMultiTargetFilter("@steam", Filter_Steam, "Steam Players", false);
|
||||
AddMultiTargetFilter("@nosteam", Filter_NoSteam, "No-Steam Players", false);
|
||||
@ -125,10 +127,10 @@ public bool Filter_NoSteam(const char[] sPattern, Handle hClients)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action OnClientPreAdminCheck(int client)
|
||||
{
|
||||
if (!g_hCvar_BlockAdmin.BoolValue)
|
||||
if(!g_hCvar_BlockAdmin.BoolValue)
|
||||
return Plugin_Continue;
|
||||
|
||||
if (IsFakeClient(client) || IsClientSourceTV(client))
|
||||
if(IsFakeClient(client) || IsClientSourceTV(client))
|
||||
return Plugin_Continue;
|
||||
|
||||
char sSteamID[32];
|
||||
@ -150,10 +152,10 @@ public Action OnClientPreAdminCheck(int client)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientPostAdminCheck(int client)
|
||||
{
|
||||
if (!g_hCvar_BlockVoice.BoolValue)
|
||||
if(!g_hCvar_BlockVoice.BoolValue)
|
||||
return;
|
||||
|
||||
if (IsFakeClient(client) || IsClientSourceTV(client))
|
||||
if(IsFakeClient(client) || IsClientSourceTV(client))
|
||||
return;
|
||||
|
||||
char sSteamID[32];
|
||||
@ -167,3 +169,49 @@ public void OnClientPostAdminCheck(int client)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientPutInServer(int client)
|
||||
{
|
||||
if(!g_hCvar_BlockSpoof.BoolValue)
|
||||
return;
|
||||
|
||||
if(IsFakeClient(client) || IsClientSourceTV(client))
|
||||
return;
|
||||
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
for(int player = 1; player <= MaxClients; player++)
|
||||
{
|
||||
if(IsFakeClient(player) || IsClientSourceTV(player))
|
||||
continue;
|
||||
|
||||
if(client == player || !IsClientConnected(player))
|
||||
continue;
|
||||
|
||||
char sPlayerSteamID[32];
|
||||
GetClientAuthId(player, AuthId_Steam2, sPlayerSteamID, sizeof(sPlayerSteamID));
|
||||
|
||||
if(StrEqual(sSteamID, sPlayerSteamID, false))
|
||||
{
|
||||
if(!SteamClientAuthenticated(sSteamID))
|
||||
{
|
||||
LogMessage("%L was not authenticated with steam, steamid already connected. Kicking connector.", client);
|
||||
KickClient(client, "Please come back later.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!SteamClientAuthenticated(sPlayerSteamID))
|
||||
{
|
||||
LogMessage("%L was not authenticated with steam, steamid already connected. Kicking connected.", player);
|
||||
KickClient(player, "Please come back later.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user