Last active
February 16, 2018 20:14
-
-
Save Nomy/a41e5d277c8911eeab1ea9561f8c3b05 to your computer and use it in GitHub Desktop.
ExploitBans - Bans players with ambiguous Steam IDs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sourcemod> | |
#pragma semicolon 1 | |
public Plugin myinfo = { | |
name = "ExploitBans", | |
author = "]HeLL[ Clan", | |
description = "Bans players with ambiguous Steam IDs.", | |
version = "1.0", | |
url = "https://hellclan.co.uk" | |
}; | |
new String:LogFile[PLATFORM_MAX_PATH]; | |
public OnPluginStart() | |
{ | |
BuildPath(Path_SM, LogFile, sizeof(LogFile), "logs/ExploitBans.log"); | |
} | |
public OnClientPutInServer(client) | |
{ | |
if(!client) | |
{ | |
return; | |
} | |
new String:SteamID[64]; | |
new String:IP[64]; | |
GetClientIP(client, IP, sizeof(IP)); | |
GetClientAuthId(client, AuthId_Steam2, SteamID, sizeof(SteamID)); | |
//LogToFile(LogFile, "%N | %s | %s", client, SteamID, IP); | |
if(StrEqual(SteamID, "") || StrEqual(SteamID, "STEAM_ID_PENDING") || StrEqual(SteamID, "STEAM_ID_STOP_IGNORING_RETVALS")) | |
{ | |
LogToFile(LogFile, "Player %N connected with ambiguous SteamID: %s | IP: %s", client, SteamID, IP); | |
CreateTimer(20.0, Timer_AuthCheck, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); | |
} | |
} | |
public Action:Timer_AuthCheck(Handle:timer, any:data) | |
{ | |
new client = GetClientOfUserId(data); | |
if(!client || !IsClientConnected(client)) | |
{ | |
return; | |
} | |
new String:SteamID[64]; | |
new String:IP[64]; | |
new String:Name[MAX_NAME_LENGTH]; | |
GetClientIP(client, IP, sizeof(IP)); | |
GetClientAuthId(client, AuthId_Steam2, SteamID, sizeof(SteamID)); | |
GetClientName(client, Name, sizeof(Name)); | |
if(StrEqual(SteamID, "") || StrEqual(SteamID, "STEAM_ID_PENDING") || StrEqual(SteamID, "STEAM_ID_STOP_IGNORING_RETVALS")) | |
{ | |
decl String:pieces[4][16]; | |
new nums[4]; | |
ExplodeString(IP, ".", pieces, 4, 16); | |
nums[0] = StringToInt(pieces[0]); | |
nums[1] = StringToInt(pieces[1]); | |
//nums[2] = StringToInt(pieces[2]); | |
//nums[3] = StringToInt(pieces[3]); | |
LogToFile(LogFile, "Player %N still has ambiguous SteamID: %s | IP: %s", client, SteamID, IP); | |
//ServerCommand("kickid %s STEAM validation rejected", GetClientUserId(client)); | |
ServerCommand("addip 1440 %s.%s.0.0", nums[0], nums[1]); | |
ServerCommand("writeip"); | |
LogToFile(LogFile, "Banned IP range for Player %s for having ambiguous SteamID: %s | IP: %s", Name, SteamID, IP); | |
} | |
else | |
LogToFile(LogFile, "Player %N no longer has ambiguous SteamID: %s | IP: %s", client, SteamID, IP); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment