2019-02-17 12:02:58 +01:00
|
|
|
#pragma semicolon 1
|
|
|
|
|
|
|
|
#include <sourcemod>
|
2019-02-24 11:31:45 +01:00
|
|
|
#include <RevEmuAPI>
|
2019-02-17 12:02:58 +01:00
|
|
|
|
|
|
|
#pragma newdecls required
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public Plugin myinfo =
|
|
|
|
{
|
|
|
|
name = "NoSteamManagerFailSafe_RevEmu",
|
|
|
|
author = "Neon",
|
|
|
|
description = "FailSafe to prevent No-Steam clients from getting admin access.",
|
|
|
|
version = "1.0.0"
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public void OnClientPostAdminCheck(int client)
|
|
|
|
{
|
|
|
|
if(IsFakeClient(client) || IsClientSourceTV(client))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(!CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC, true))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(!IsSteam(client))
|
|
|
|
{
|
|
|
|
char sConnectionType[32];
|
|
|
|
GetConnectionType(client, sConnectionType, sizeof(sConnectionType));
|
|
|
|
|
|
|
|
LogMessage("%L got admin access while not being authentiated with steam (type: %s). Attempting to kick.", sConnectionType);
|
|
|
|
LogAction(client, -1, "\"%L\"got admin access while not being authentiated with steam (type: %s). Attempting to kick.", sConnectionType);
|
|
|
|
KickClient(client, "Security Validation failed. Please contact an Administrator.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public void GetConnectionType(int client, char[] sConnectionType, int iMaxLength)
|
|
|
|
{
|
|
|
|
char sConnectionTypeInternal[32];
|
|
|
|
|
2019-02-24 11:31:45 +01:00
|
|
|
RevEmu_UserType PlayerType = RevEmu_GetPlayerType(client);
|
|
|
|
if (PlayerType == Unknown)
|
2019-02-17 12:02:58 +01:00
|
|
|
sConnectionTypeInternal = "Error";
|
|
|
|
else if (PlayerType == SteamLegitUser)
|
|
|
|
sConnectionTypeInternal = "SteamLegit";
|
|
|
|
else if (PlayerType == SteamCrackedUser)
|
|
|
|
sConnectionTypeInternal = "SteamCracked";
|
|
|
|
else if (PlayerType == RevEmuUser)
|
|
|
|
sConnectionTypeInternal = "RevEmu";
|
|
|
|
else if (PlayerType == RevEmuUserOld)
|
|
|
|
sConnectionTypeInternal = "RevEmuOld";
|
|
|
|
else if (PlayerType == SettiSRCScanBot)
|
|
|
|
sConnectionTypeInternal = "SettiSRCScanBot";
|
|
|
|
else if (PlayerType == RevEmuUserV74)
|
|
|
|
sConnectionTypeInternal = "RevEmuV74";
|
|
|
|
else if (PlayerType == RevEmuUserVeryOld)
|
|
|
|
sConnectionTypeInternal = "RevEmuVeryOld";
|
|
|
|
else if (PlayerType == UnknownUser)
|
|
|
|
sConnectionTypeInternal = "Unknown";
|
|
|
|
else if (PlayerType == Steam2Legit)
|
|
|
|
sConnectionTypeInternal = "Steam2Legit";
|
|
|
|
else if (PlayerType == Steam2Cracked)
|
|
|
|
sConnectionTypeInternal = "Steam2Cracked";
|
|
|
|
|
|
|
|
strcopy(sConnectionType, iMaxLength, sConnectionTypeInternal);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
public bool IsSteam(int client)
|
|
|
|
{
|
|
|
|
return (RevEmu_GetPlayerType(client) == SteamLegitUser);
|
|
|
|
}
|