ianlucas / cs2-inventory-simulator-plugin

A CounterStrikeSharp plugin for integrating with CS2 Inventory Simulator
MIT License
30 stars 9 forks source link

Gamedata update for CS2 v1.40.0.5 #7

Closed walia6 closed 6 months ago

walia6 commented 6 months ago

In latest CS2 update, GiveNamedItem Linux signature has changed. While CS# doesn't update it, you can do it by updating counterstrikesharp/gamedata/gamedata.json:

  "GiveNamedItem": {
    "signatures": {
      "library": "server",
      "windows": "\\x48\\x89\\x5C\\x24\\x2A\\x48\\x89\\x74\\x24\\x2A\\x55\\x57\\x41\\x2A\\x41\\x2A\\x41\\x2A\\x48\\x2A\\x2A\\x2A\\x2A\\x48\\x2A\\x2A\\x2A\\x2A\\x2A\\x2A\\x4D\\x2A\\x2A\\x48",
      "linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xD6\\x41\\x55\\x49\\x89\\xFD\\x41\\x54\\x48"
    }
  },

I am running the following:

Ubuntu 22.04.4 mmsource-2.0.0-git1289-linux counterstrikesharp-with-runtime-build-215-linux-7cae4be InventorySimulator-v1.0.0-beta.22

The server boots, throwing a "Failed to load plugin error"

When running css_plugins list, it shows InventorySimulator as LOADING. I have a separate plugin, CS2Rcon, which shows as LOADED.

The gloves I set are working, while weapon skins and knife skins are not.

Here is the excerpt from the log I believe is relevant:


02:22:55 [INFO] (cssharp:PluginContext) Loading plugin InventorySimulator
02:22:55 [EROR] (cssharp:PluginManager) Failed to load plugin from /home/ubuntu/cs2/game/csgo/addons/counterstrikesharp/plugins/InventorySimulator/InventorySimulator.dll
CounterStrikeSharp.API.Core.NativeException: Invalid function pointer
   at CounterStrikeSharp.API.Core.ScriptContext.CheckErrors() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/ScriptContext.cs:line 176
   at CounterStrikeSharp.API.Core.NativeAPI.HookFunction(IntPtr function, InputArgument hook, Boolean post) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/API.cs:line 1033
   at CounterStrikeSharp.API.Modules.Memory.DynamicFunctions.BaseMemoryFunction.Hook(Func`2 handler, HookMode mode) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/Memory/DynamicFunctions/BaseMemoryFunction.cs:line 62
   at InventorySimulator.InventorySimulator.Load(Boolean hotReload) in C:\Users\ianlu\Projects\cs2-inventory-simulator-plugin\source\InventorySimulator\InventorySimulator.cs:line 50
   at CounterStrikeSharp.API.Core.Plugin.PluginContext.Load(Boolean hotReload) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/PluginContext.cs:line 218
   at CounterStrikeSharp.API.Core.Plugin.Host.PluginManager.LoadPlugin(String path) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/Host/PluginManager.cs:line 125
   at CounterStrikeSharp.API.Core.Plugin.Host.PluginManager.Load() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/Host/PluginManager.cs:line 93```
ianlucas commented 6 months ago

I'd recommend you to reinstall everything. The error points to line 50 which is the hook for giving a named item to a player - so it appears to be an issue with CS#. I've personally tested in latest Windows and Linux, so I'm pretty sure it's some misconfiguration on your end.

Make sure gamedata is correct and FollowCS2ServerGuidelines is false.

ianlucas commented 6 months ago

Btw looks like CS# had a new update specifically for this issue. You may try that as well.

ianlucas commented 6 months ago

Okay looks like it's broken. I wasn't aware Valve released another update. I'll look into it.

ianlucas commented 6 months ago

Currently CounterStrikeSharp's GiveNamedItem is outdated. Until it is updated, update your server gamedata.

walia6 commented 6 months ago

Worked for me 👍

Thanks

ianlucas commented 6 months ago

Resolved by https://github.com/roflmuffin/CounterStrikeSharp/releases/tag/v218