diff --git a/NoSteamManager/scripting/NoSteamManagerFailSafe_RevEmu.sp b/NoSteamManager/scripting/NoSteamManagerFailSafe_RevEmu.sp new file mode 100644 index 00000000..8f510587 --- /dev/null +++ b/NoSteamManager/scripting/NoSteamManagerFailSafe_RevEmu.sp @@ -0,0 +1,82 @@ +#pragma semicolon 1 + +#include +#include + +#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]; + + RevEmu_PlayerType PlayerType = RevEmu_GetPlayerType(client); + if (PlayerType == ErrorGet) + 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); +} \ No newline at end of file