From ede0cae6d6211816bd54f0e43927785682810478 Mon Sep 17 00:00:00 2001 From: imi-tat0r Date: Thu, 15 Aug 2024 08:51:53 +0200 Subject: [PATCH] fix: updated basecmd offset chore: use CSSharpUtils --- .github/workflows/build-publish.yml | 15 ++++++++++----- CS2-Essentials/CS2-Essentials.csproj | 2 +- CS2-Essentials/CUserCmd.cs | 2 +- CS2-Essentials/Features/RapidFireFix.cs | 2 +- CS2-Essentials/Features/TeleportFix.cs | 2 +- CS2-Essentials/Features/WeaponRestrict.cs | 2 +- README.MD | 4 ++-- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index 8487b4d..09a9fc8 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -47,13 +47,18 @@ jobs: - name: Restore dependencies run: dotnet restore - - name: Publish artifacts + - name: Build run: dotnet build -c Release --no-restore /p:Version=${{ env.VERSION_NUMBER }} - - - name: Check contents of bin/Release directory + + - name: Copy CSSharpUtils.dll run: | - echo "Listing contents of CS2-Essentials/bin/Release/net8.0/" - ls -la CS2-Essentials/bin/Release/net8.0/ + mkdir -p release/addons/counterstrikesharp/plugins/CS2-Essentials + CSSharpUtilsDllPath=$(find ~/.nuget/packages/cssharputils/ -name "CSSharpUtils.dll" | head -n 1) + if [ -z "$CSSharpUtilsDllPath" ]; then + echo "CSSharpUtils.dll not found. Exiting." + exit 1 + fi + cp "$CSSharpUtilsDllPath" release/addons/counterstrikesharp/plugins/CS2-Essentials/ - name: Create necessary directory structure and copy files run: | diff --git a/CS2-Essentials/CS2-Essentials.csproj b/CS2-Essentials/CS2-Essentials.csproj index 066721b..b2d1339 100644 --- a/CS2-Essentials/CS2-Essentials.csproj +++ b/CS2-Essentials/CS2-Essentials.csproj @@ -9,7 +9,7 @@ - + diff --git a/CS2-Essentials/CUserCmd.cs b/CS2-Essentials/CUserCmd.cs index 963365f..c80c1de 100644 --- a/CS2-Essentials/CUserCmd.cs +++ b/CS2-Essentials/CUserCmd.cs @@ -18,7 +18,7 @@ public CUserCmd(IntPtr pointer) if (Handle == IntPtr.Zero) return null; - var baseCmd = Unsafe.Read((void*)(Handle + 0x30)); + var baseCmd = Unsafe.Read((void*)(Handle + 0x40)); if (baseCmd == IntPtr.Zero) return null; diff --git a/CS2-Essentials/Features/RapidFireFix.cs b/CS2-Essentials/Features/RapidFireFix.cs index b06d538..b1c1d47 100644 --- a/CS2-Essentials/Features/RapidFireFix.cs +++ b/CS2-Essentials/Features/RapidFireFix.cs @@ -73,7 +73,7 @@ public HookResult OnWeaponFire(EventWeaponFire eventWeaponFire, GameEventInfo in if (!eventWeaponFire.Userid.IsPlayer()) return HookResult.Continue; - var firedWeapon = eventWeaponFire.Userid.Pawn.Value?.WeaponServices?.ActiveWeapon.Value; + var firedWeapon = eventWeaponFire.Userid!.Pawn.Value?.WeaponServices?.ActiveWeapon.Value; var weaponData = firedWeapon?.GetVData(); var index = eventWeaponFire.Userid.Pawn.Index; diff --git a/CS2-Essentials/Features/TeleportFix.cs b/CS2-Essentials/Features/TeleportFix.cs index dfce354..4f35d5d 100644 --- a/CS2-Essentials/Features/TeleportFix.cs +++ b/CS2-Essentials/Features/TeleportFix.cs @@ -69,7 +69,7 @@ public HookResult RunCommand(DynamicHook h) viewAngles.Fix(); // not warned yet or last warning was more than 3 seconds ago - if (_teleportBlockWarnings.TryGetValue(player.Index, out var lastWarningTime) && + if (_teleportBlockWarnings.TryGetValue(player!.Index, out var lastWarningTime) && !(lastWarningTime + 3 <= Server.CurrentTime)) return HookResult.Changed; diff --git a/CS2-Essentials/Features/WeaponRestrict.cs b/CS2-Essentials/Features/WeaponRestrict.cs index 7c080a0..6d62382 100644 --- a/CS2-Essentials/Features/WeaponRestrict.cs +++ b/CS2-Essentials/Features/WeaponRestrict.cs @@ -94,7 +94,7 @@ public HookResult OnItemPurchase(EventItemPurchase eventItemPurchase, GameEventI return HookResult.Continue; // not exceeding limits - var weaponsInTeam = GetWeaponCountInTeam(item, player.Team); + var weaponsInTeam = GetWeaponCountInTeam(item, player!.Team); var allowedWeapons = GetAllowedWeaponCount(item); var willExceedLimits = allowedWeapons != -1 && weaponsInTeam + 1 > allowedWeapons; diff --git a/README.MD b/README.MD index d3bba2a..4bf26af 100644 --- a/README.MD +++ b/README.MD @@ -1,6 +1,6 @@ ![Copyright ev0lve Digital](https://img.shields.io/badge/Copyright-ev0lve%20Digital-blue) ![GitHub License](https://img.shields.io/github/license/HvH-gg/CS2-Essentials) ![Issues](https://img.shields.io/github/issues/HvH-gg/CS2-Essentials) ![Downloads](https://img.shields.io/github/downloads/HvH-gg/CS2-Essentials/total) ![Stars](https://img.shields.io/github/stars/HvH-gg/CS2-Essentials) -# [HvH.gg](https://hvh.gg) CS2 Essentials (1.2.4) +# [HvH.gg](https://hvh.gg) CS2 Essentials (1.2.5) ### If you use this plugin, you do NOT need [RapidFireFix](https://github.com/HvH-gg/RapidFireFix) anymore. Our CS2 Essentials plugin is the only plugin you need to run a successful HvH server. It includes basic features like **reset score** and **rage quit** as well as optional restrictions for **weapons**, **friendly fire**, **rapid fire** and other exploit/crash fixes. @@ -16,7 +16,7 @@ Our CS2 Essentials plugin is the only plugin you need to run a successful HvH se # Requirements - [Metamod:Source](https://www.sourcemm.net/downloads.php/?branch=master) -- [CounterStrikeSharp(v191)](https://github.com/roflmuffin/CounterStrikeSharp/releases) +- [CounterStrikeSharp(v255)](https://github.com/roflmuffin/CounterStrikeSharp/releases) # Install 1. Install Metamod:Source and CounterStrikeSharp