mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-17 18:39:07 +00:00
Compare commits
6 Commits
CS2-Simple
...
1d65d4be78
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d65d4be78 | ||
|
|
ca61d8b79a | ||
|
|
4e578747e3 | ||
|
|
a643f7aea9 | ||
|
|
8e9f10132f | ||
|
|
3e19408416 |
@@ -1 +1 @@
|
||||
1.7.7-alpha-7
|
||||
1.7.7-alpha-9
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.328" />
|
||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.340" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4-beta1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -20,6 +20,7 @@ public interface ICS2_SimpleAdminApi
|
||||
public event Action<PlayerInfo, PlayerInfo?, PenaltyType, string, int, int?, int?>? OnPlayerPenaltied;
|
||||
public event Action<SteamID, PlayerInfo?, PenaltyType, string, int, int?, int?>? OnPlayerPenaltiedAdded;
|
||||
public event Action<string, string?, bool, object>? OnAdminShowActivity;
|
||||
public event Action<int, bool>? OnAdminToggleSilent;
|
||||
|
||||
public void IssuePenalty(CCSPlayerController player, CCSPlayerController? admin, PenaltyType penaltyType, string reason, int duration = -1);
|
||||
public void IssuePenalty(SteamID steamid, CCSPlayerController? admin, PenaltyType penaltyType, string reason, int duration = -1);
|
||||
@@ -28,4 +29,5 @@ public interface ICS2_SimpleAdminApi
|
||||
public void ShowAdminActivity(string messageKey, string? callerName = null, bool dontPublish = false, params object[] messageArgs);
|
||||
|
||||
public bool IsAdminSilent(CCSPlayerController player);
|
||||
public HashSet<int> ListSilentAdminsSlots();
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
|
||||
namespace CS2_SimpleAdminApi;
|
||||
@@ -27,12 +28,13 @@ public class PlayerInfo(
|
||||
public bool WaitingForKick { get; set; } = false;
|
||||
public List<(ulong SteamId, string PlayerName)> AccountsAssociated { get; set; } = [];
|
||||
public DiePosition? DiePosition { get; set; }
|
||||
public bool IsLoaded { get; set; }
|
||||
}
|
||||
|
||||
public class DiePosition(Vector_t position, QAngle_t angle)
|
||||
public class DiePosition(Vector3 position, Vector3 angle)
|
||||
{
|
||||
public Vector_t Position { get; } = position;
|
||||
public QAngle_t Angle { get; } = angle;
|
||||
public Vector3 Position { get; } = position;
|
||||
public Vector3 Angle { get; } = angle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CS2_SimpleAdminApi;
|
||||
|
||||
public struct QAngle_t : IAdditionOperators<QAngle_t, QAngle_t, QAngle_t>,
|
||||
ISubtractionOperators<QAngle_t, QAngle_t, QAngle_t>,
|
||||
IMultiplyOperators<QAngle_t, float, QAngle_t>,
|
||||
IDivisionOperators<QAngle_t, float, QAngle_t>
|
||||
{
|
||||
public float X, Y, Z;
|
||||
|
||||
public const int SIZE = 3;
|
||||
|
||||
public unsafe float this[int i]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
if (i < 0 || i > SIZE)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
|
||||
fixed (void* ptr = &this)
|
||||
{
|
||||
return Unsafe.Read<float>(Unsafe.Add<float>(ptr, i));
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (i < 0 || i > SIZE)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
|
||||
fixed (void* ptr = &this)
|
||||
{
|
||||
Unsafe.Write(Unsafe.Add<float>(ptr, i), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public QAngle_t()
|
||||
{
|
||||
}
|
||||
|
||||
public unsafe QAngle_t(nint ptr) : this(MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AsRef<float>((void*)ptr), SIZE))
|
||||
{
|
||||
}
|
||||
|
||||
public QAngle_t(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public QAngle_t(ReadOnlySpan<float> values)
|
||||
{
|
||||
if (values.Length < SIZE)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(values));
|
||||
}
|
||||
|
||||
this = Unsafe.ReadUnaligned<QAngle_t>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values)));
|
||||
}
|
||||
|
||||
public unsafe (Vector_t fwd, Vector_t right, Vector_t up) AngleVectors()
|
||||
{
|
||||
Vector_t fwd = default, right = default, up = default;
|
||||
|
||||
nint pFwd = (nint)Unsafe.AsPointer(ref fwd);
|
||||
nint pRight = (nint)Unsafe.AsPointer(ref right);
|
||||
nint pUp = (nint)Unsafe.AsPointer(ref up);
|
||||
|
||||
fixed (void* ptr = &this)
|
||||
{
|
||||
NativeAPI.AngleVectors((nint)ptr, pFwd, pRight, pUp);
|
||||
}
|
||||
|
||||
return ( fwd, right, up );
|
||||
}
|
||||
|
||||
public unsafe void AngleVectors(out Vector_t fwd, out Vector_t right, out Vector_t up)
|
||||
{
|
||||
fixed (void* ptr = &this, pFwd = &fwd, pRight = &right, pUp = &up)
|
||||
{
|
||||
NativeAPI.AngleVectors((nint)ptr, (nint)pFwd, (nint)pRight, (nint)pUp);
|
||||
}
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return $"{X:n2} {Y:n2} {Z:n2}";
|
||||
}
|
||||
|
||||
public static QAngle_t operator +(QAngle_t a, QAngle_t b)
|
||||
{
|
||||
return new QAngle_t(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
|
||||
}
|
||||
|
||||
public static QAngle_t operator -(QAngle_t a, QAngle_t b)
|
||||
{
|
||||
return new QAngle_t(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
|
||||
}
|
||||
|
||||
public static QAngle_t operator -(QAngle_t a)
|
||||
{
|
||||
return new QAngle_t(-a.X, -a.Y, -a.Z);
|
||||
}
|
||||
|
||||
public static QAngle_t operator *(QAngle_t a, float b)
|
||||
{
|
||||
return new QAngle_t(a.X * b, a.Y * b, a.Z * b);
|
||||
}
|
||||
|
||||
public static QAngle_t operator /(QAngle_t a, float b)
|
||||
{
|
||||
return new QAngle_t(a.X / b, a.Y / b, a.Z / b);
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CS2_SimpleAdminApi;
|
||||
|
||||
public struct Vector_t : IAdditionOperators<Vector_t, Vector_t, Vector_t>,
|
||||
ISubtractionOperators<Vector_t, Vector_t, Vector_t>,
|
||||
IMultiplyOperators<Vector_t, float, Vector_t>,
|
||||
IDivisionOperators<Vector_t, float, Vector_t>
|
||||
{
|
||||
public float X, Y, Z;
|
||||
|
||||
public const int SIZE = 3;
|
||||
|
||||
public unsafe float this[int i]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
if (i < 0 || i > SIZE)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
|
||||
fixed (void* ptr = &this)
|
||||
{
|
||||
return Unsafe.Read<float>(Unsafe.Add<float>(ptr, i));
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (i < 0 || i > SIZE)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
|
||||
fixed (void* ptr = &this)
|
||||
{
|
||||
Unsafe.Write(Unsafe.Add<float>(ptr, i), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector_t()
|
||||
{
|
||||
}
|
||||
|
||||
public unsafe Vector_t(nint ptr) : this(MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AsRef<float>((void*)ptr), SIZE))
|
||||
{
|
||||
}
|
||||
|
||||
public Vector_t(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public Vector_t(ReadOnlySpan<float> values)
|
||||
{
|
||||
if (values.Length < SIZE)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(values));
|
||||
}
|
||||
|
||||
this = Unsafe.ReadUnaligned<Vector_t>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values)));
|
||||
}
|
||||
|
||||
public void Scale(float scale)
|
||||
{
|
||||
X *= scale;
|
||||
Y *= scale;
|
||||
Z *= scale;
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return $"{X:n2} {Y:n2} {Z:n2}";
|
||||
}
|
||||
|
||||
public static Vector_t operator +(Vector_t a, Vector_t b)
|
||||
{
|
||||
return new Vector_t(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
|
||||
}
|
||||
|
||||
public static Vector_t operator -(Vector_t a, Vector_t b)
|
||||
{
|
||||
return new Vector_t(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
|
||||
}
|
||||
|
||||
public static Vector_t operator -(Vector_t a)
|
||||
{
|
||||
return new Vector_t(-a.X, -a.Y, -a.Z);
|
||||
}
|
||||
|
||||
public static Vector_t operator *(Vector_t a, float b)
|
||||
{
|
||||
return new Vector_t(a.X * b, a.Y * b, a.Z * b);
|
||||
}
|
||||
|
||||
public static Vector_t operator /(Vector_t a, float b)
|
||||
{
|
||||
return new Vector_t(a.X / b, a.Y / b, a.Z / b);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user