mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 02:41:55 +00:00
1.3.0e
- Added `css_rename` - Added `css_silence` - Added `css_addsilence` - Added `css_unsilence` - PlayerPenaltyManager class - Fix for invalid players New commands localized only for `pl` and `en`, if u can please make pr for other languages
This commit is contained in:
32
Helper.cs
32
Helper.cs
@@ -2,9 +2,12 @@
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Menu;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace CS2_SimpleAdmin
|
||||
@@ -33,6 +36,12 @@ namespace CS2_SimpleAdmin
|
||||
);
|
||||
}
|
||||
|
||||
public static List<CCSPlayerController> GetValidPlayers()
|
||||
{
|
||||
return Utilities.GetPlayers().FindAll(p => p != null && p.IsValid && p.SteamID.ToString().Length == 17 && p.Connected == PlayerConnectedState.PlayerConnected && !p.IsBot && !p.IsHLTV);
|
||||
}
|
||||
|
||||
|
||||
public static bool IsValidSteamID64(string input)
|
||||
{
|
||||
string pattern = @"^\d{17}$";
|
||||
@@ -154,4 +163,27 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SchemaString<SchemaClass> : NativeObject where SchemaClass : NativeObject
|
||||
{
|
||||
public SchemaString(SchemaClass instance, string member) : base(Schema.GetSchemaValue<nint>(instance.Handle, typeof(SchemaClass).Name!, member))
|
||||
{ }
|
||||
|
||||
public unsafe void Set(string str)
|
||||
{
|
||||
byte[] bytes = this.GetStringBytes(str);
|
||||
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
Unsafe.Write((void*)(this.Handle.ToInt64() + i), bytes[i]);
|
||||
}
|
||||
|
||||
Unsafe.Write((void*)(this.Handle.ToInt64() + bytes.Length), 0);
|
||||
}
|
||||
|
||||
private byte[] GetStringBytes(string str)
|
||||
{
|
||||
return Encoding.ASCII.GetBytes(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user