NoSteamManager: Update include + native.
This commit is contained in:
parent
9160564c8e
commit
c73a8f9c97
@ -1,82 +0,0 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include <RevEmuAPI>
|
||||
|
||||
#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_UserType PlayerType = RevEmu_GetPlayerType(client);
|
||||
if (PlayerType == Unknown)
|
||||
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);
|
||||
}
|
@ -104,7 +104,7 @@ public Action Command_DisplaySteamStats(int client, int args)
|
||||
if(IsClientInGame(i) && !IsFakeClient(i) && !RevEmu_IsPlayerSteam(i))
|
||||
{
|
||||
char sConnectionType[32];
|
||||
GetConnectionType(i, sConnectionType, sizeof(sConnectionType));
|
||||
RevEmu_GetPlayerType(i, sConnectionType, sizeof(sConnectionType));
|
||||
Format(aBuf, sizeof(aBuf), "%s%L %s \n", aBuf, i, sConnectionType);
|
||||
}
|
||||
}
|
||||
@ -173,7 +173,7 @@ public Action OnClientPreAdminCheck(int client)
|
||||
if(!RevEmu_IsPlayerSteam(client))
|
||||
{
|
||||
char sConnectionType[32];
|
||||
GetConnectionType(client, sConnectionType, sizeof(sConnectionType));
|
||||
RevEmu_GetPlayerType(client, sConnectionType, sizeof(sConnectionType));
|
||||
LogMessage("%L was not authenticated with steam (type: %s), denying admin.", client, sConnectionType);
|
||||
NotifyPostAdminCheck(client);
|
||||
|
||||
@ -237,7 +237,7 @@ public void TQueryCB(Database db, DBResultSet results, const char[] error, any d
|
||||
GetClientIP(client, sCurrentIP, sizeof(sCurrentIP));
|
||||
|
||||
char sCurrentConnectionType[32];
|
||||
GetConnectionType(client, sCurrentConnectionType, sizeof(sCurrentConnectionType));
|
||||
RevEmu_GetPlayerType(client, sCurrentConnectionType, sizeof(sCurrentConnectionType));
|
||||
|
||||
int iTimestamp = GetTime();
|
||||
|
||||
@ -274,40 +274,6 @@ public void TQueryCB(Database db, DBResultSet results, const char[] error, any d
|
||||
g_hDatabaseAntiSpoofing.Query(SQL_DoNothing, sQuery, GetClientUserId(client));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void GetConnectionType(int client, char[] sConnectionType, int iMaxLength)
|
||||
{
|
||||
char sConnectionTypeInternal[32];
|
||||
|
||||
RevEmu_UserType PlayerType = RevEmu_GetPlayerType(client);
|
||||
if (PlayerType == Invalid)
|
||||
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:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -3,21 +3,6 @@
|
||||
#endif
|
||||
#define _RevEmuAPI_included
|
||||
|
||||
enum RevEmu_UserType
|
||||
{
|
||||
Invalid = -1,
|
||||
SteamLegitUser = 0,
|
||||
SteamCrackedUser,
|
||||
RevEmuUser,
|
||||
RevEmuUserOld,
|
||||
SettiSRCScanBot,
|
||||
RevEmuUserV74,
|
||||
RevEmuUserVeryOld,
|
||||
UnknownUser,
|
||||
Steam2Legit,
|
||||
Steam2Cracked
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if clients usertype is legit.
|
||||
*
|
||||
@ -32,11 +17,13 @@ native bool RevEmu_IsPlayerSteam(int client);
|
||||
* Retrieve clients usertype.
|
||||
*
|
||||
* @param clients The client index.
|
||||
* @param type The buffer to write to.
|
||||
* @param maxlength The maximum buffer length.
|
||||
*
|
||||
* @return The clients usertype.
|
||||
* @return True on success, false otherwise.
|
||||
* @error Invalid client index, not connected or fake client.
|
||||
*/
|
||||
native RevEmu_UserType RevEmu_GetPlayerType(int client);
|
||||
native bool RevEmu_GetPlayerType(int client, char[] type, int maxlength);
|
||||
|
||||
|
||||
public Extension __ext_RevEmuAPI =
|
||||
|
Loading…
Reference in New Issue
Block a user