IP address banning
- IP address banning **Require CounterStrikeSharp v98**
This commit is contained in:
parent
0f32daa4c0
commit
d16b92e694
7 changed files with 137 additions and 16 deletions
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue