mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-19 10:58:20 +00:00
IP address banning
- IP address banning **Require CounterStrikeSharp v98**
This commit is contained in:
15
Helper.cs
15
Helper.cs
@@ -24,6 +24,14 @@ namespace CS2_SimpleAdmin
|
||||
);
|
||||
}
|
||||
|
||||
public static List<CCSPlayerController> GetPlayerFromIp(string ipAddress)
|
||||
{
|
||||
return Utilities.GetPlayers().FindAll(x =>
|
||||
x.IpAddress != null &&
|
||||
x.IpAddress.Split(":")[0].Equals(ipAddress)
|
||||
);
|
||||
}
|
||||
|
||||
public static bool IsValidSteamID64(string input)
|
||||
{
|
||||
string pattern = @"^\d{17}$";
|
||||
@@ -31,6 +39,13 @@ namespace CS2_SimpleAdmin
|
||||
return Regex.IsMatch(input, pattern);
|
||||
}
|
||||
|
||||
public static bool IsValidIP(string input)
|
||||
{
|
||||
string pattern = @"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
|
||||
|
||||
return Regex.IsMatch(input, pattern);
|
||||
}
|
||||
|
||||
public static TargetResult GetTarget(string target, out CCSPlayerController? player)
|
||||
{
|
||||
player = null;
|
||||
|
||||
Reference in New Issue
Block a user