## GENERAL - Updated CSS to version 1.0.369. - Upgraded the project from .NET 8.0 to .NET 10.0. - Updated Turkish language translation by @ByDexterTR. - Added Russian language translation by @213sdfsdgf. - Fixed an issue with incorrect display of Arabic nicknames. - Used ForceFullUpdate to resolve the "FATAL ERROR: CopyExistingEntity" crash. - Disabled stale HandleCommandDrop hook to avoid crashes when a player joins a team (thanks to @vladimir214sd). - Added new signatures to gamedata. - Added the ability to configure the number of grenades for every skill that uses grenades as part of its ability (e.g., Miner, AntyFlash, MagneticDecoy, etc.). ## SKILL IMPROVEMENTS - Re-Zombie: -- Fixed weapon switching issues when a player is holding a Zeus and a knife. -- Weapons are now removed for bots in zombie mode. - Ghost: -- Blocked the ability to use the Zeus. - Thorns: -- Added a configurable maximum health limit (37 HP) for the damage that can be reflected. - Second Life / Phoenix / Re-Zombie: -- Fixed an issue where players would occasionally fail to respawn if they took too much damage too quickly. - Ghost / Chicken: -- Blocked the ability to use the SG556 (`weapon_sg556`). - Wallhack: -- Fixed a bug that caused temporary enemy highlighting right after death. - Cypher: -- Added camera position persistence. - God Mode: -- Fixed an issue with permanent immortality triggering after reaching exactly 0 HP. - Weapons Swap: -- The ammo count is now also transferred when weapons are swapped. - Muhammed: -- Renamed the skill to "DeathBomb". - Spectator: -- Fixed a bug where a player with the Chicken skill would still display as a ragdoll after death when spectated. - Friendly Fire: -- The skill now works even when the server's mp_friendlyfire setting is set to 0. - Baseball: -- Disabled teammate killing.
101 lines
No EOL
2.8 KiB
C#
101 lines
No EOL
2.8 KiB
C#
// https://discord.com/channels/1160907911501991946/1508172390863994910/1508180670659166348
|
|
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using CounterStrikeSharp.API;
|
|
using CounterStrikeSharp.API.Core;
|
|
using CounterStrikeSharp.API.Modules.Memory;
|
|
|
|
namespace jRandomSkills.src.utils
|
|
{
|
|
|
|
#region Native Structs
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe struct CUtlMemory<T> where T : unmanaged
|
|
{
|
|
public T* m_pMemory;
|
|
public int m_nAllocationCount;
|
|
public int m_nGrowSize;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe struct CUtlVector<T> where T : unmanaged
|
|
{
|
|
public int m_Size;
|
|
public CUtlMemory<T> m_Memory;
|
|
|
|
public int Count => m_Size;
|
|
|
|
public ref T Element(int index)
|
|
{
|
|
if (index < 0 || index >= m_Size)
|
|
throw new IndexOutOfRangeException();
|
|
|
|
return ref m_Memory.m_pMemory[index];
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Network Services
|
|
|
|
public class INetworkServerService : NativeObject
|
|
{
|
|
private readonly VirtualFunctionWithReturn<nint, nint> GetIGameServerFunc;
|
|
|
|
public INetworkServerService() : base(NativeAPI.GetValveInterface(0, "NetworkServerService_001"))
|
|
{
|
|
GetIGameServerFunc = new VirtualFunctionWithReturn<nint, nint>(Handle, GameData.GetOffset("INetworkServerService_GetIGameServer"));
|
|
}
|
|
|
|
public INetworkGameServer GetIGameServer()
|
|
{
|
|
return new INetworkGameServer(GetIGameServerFunc.Invoke(Handle));
|
|
}
|
|
}
|
|
|
|
public unsafe class INetworkGameServer(nint ptr) : NativeObject(ptr)
|
|
{
|
|
private static readonly int SlotsOffset = GameData.GetOffset("INetworkGameServer_Slots");
|
|
|
|
private ref CUtlVector<nint> Slots => ref Unsafe.AsRef<CUtlVector<nint>>((void*)(Handle + SlotsOffset));
|
|
|
|
public CServerSideClient? GetClientBySlot(int slot)
|
|
{
|
|
if (slot < 0 || slot >= Slots.Count)
|
|
return null;
|
|
|
|
var ptr = Slots.Element(slot);
|
|
|
|
if (ptr == nint.Zero)
|
|
return null;
|
|
|
|
return new CServerSideClient(ptr);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region CServerSideClient
|
|
|
|
public unsafe class CServerSideClient(nint ptr) : NativeObject(ptr)
|
|
{
|
|
private static readonly int m_nDeltaTick = GameData.GetOffset("CServerSideClient_m_nDeltaTick");
|
|
|
|
private ref T Field<T>(int offset) where T : unmanaged
|
|
{
|
|
return ref Unsafe.AsRef<T>((void*)(Handle + offset));
|
|
}
|
|
|
|
public int DeltaTick
|
|
{
|
|
get => Field<int>(m_nDeltaTick);
|
|
set => Field<int>(m_nDeltaTick) = value;
|
|
}
|
|
|
|
public void ForceFullUpdate() => DeltaTick = -1;
|
|
}
|
|
|
|
#endregion
|
|
} |