Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit a807e9a

Browse files
committed
fix: Possible fix for GiveNamedItem2 problems on some servers
1 parent 6c8229d commit a807e9a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src-plugin/Plugin/Plugin.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
using K4Arenas.Models;
99
using CounterStrikeSharp.API;
1010
using CounterStrikeSharp.API.Modules.Timers;
11+
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
12+
using System.Runtime.InteropServices;
1113

1214
[MinimumApiVersion(200)]
1315
public sealed partial class Plugin : BasePlugin, IPluginConfig<PluginConfig>
1416
{
1517
//** ? PLUGIN GLOBALS */
1618
public required PluginConfig Config { get; set; } = new PluginConfig();
1719
public static readonly Random rng = new Random();
20+
public static MemoryFunctionVoid<IntPtr, string, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr>? GiveNamedItem2;
1821

1922
public void OnConfigParsed(PluginConfig config)
2023
{
@@ -25,6 +28,14 @@ public void OnConfigParsed(PluginConfig config)
2528
base.Logger.LogWarning("Configuration version mismatch (Expected: {0} | Current: {1})", this.Config.Version, config.Version);
2629
}
2730

31+
//** ? Signature Check */
32+
33+
GiveNamedItem2 = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
34+
? new(@"\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x41\x54\x53\x48\x83\xEC\x18\x48\x89\x7D\xC8\x48\x85\xF6\x74")
35+
: RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
36+
? new(@"\x48\x83\xEC\x38\x48\xC7\x44\x24\x28\x00\x00\x00\x00\x45\x33\xC9\x45\x33\xC0\xC6\x44\x24\x20\x00\xE8\x2A\x2A\x2A\x2A\x48\x85")
37+
: null;
38+
2839
//** ? Load Round Types */
2940

3041
if (config.RoundSettings.Count > 0)

0 commit comments

Comments
 (0)