diff --git a/NoSteamManager/scripting/NoSteamManager.sp b/NoSteamManager/scripting/NoSteamManager.sp index 7f763f1b..c24b834d 100644 --- a/NoSteamManager/scripting/NoSteamManager.sp +++ b/NoSteamManager/scripting/NoSteamManager.sp @@ -3,6 +3,7 @@ #include #include #include +#include #pragma newdecls required @@ -11,6 +12,9 @@ ConVar g_hCvar_BlockAdmin; ConVar g_hCvar_BlockVoice; ConVar g_hCvar_BlockSpoof; +/* REGEX */ +Regex g_hReg_ValidateSteamID; + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- @@ -27,6 +31,8 @@ public Plugin myinfo = //---------------------------------------------------------------------------------------------------- public void OnPluginStart() { + g_hReg_ValidateSteamID = CompileRegex("[^STEAM_[01]:[01]:\\d{1,10}]"); + 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); @@ -184,6 +190,9 @@ public void OnClientPutInServer(int client) char sSteamID[32]; GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID)); + if(MatchRegex(g_hReg_ValidateSteamID, sSteamID) <= 0) + return; + for(int player = 1; player <= MaxClients; player++) { if(client == player || !IsClientConnected(player)) @@ -195,12 +204,16 @@ public void OnClientPutInServer(int client) char sPlayerSteamID[32]; GetClientAuthId(player, AuthId_Steam2, sPlayerSteamID, sizeof(sPlayerSteamID)); + if(MatchRegex(g_hReg_ValidateSteamID, sPlayerSteamID) <= 0) + continue; + 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; } @@ -208,6 +221,7 @@ public void OnClientPutInServer(int client) { LogMessage("%L was not authenticated with steam, steamid already connected. Kicking connected.", player); KickClient(player, "Please come back later."); + return; }