Hello. I stumbled upon this one problem where trying to get any value out of the ViewOffset field from CCSPlayerPawn is just simply not working. I attached the issue down below with the stacktrace.
X is tested and confirmed to be problematic. Y and Z hasn't been tested but I would assume they would throw the same error
[INFO] (plugin:TB Anti-Cheat) [TBAC] Exception in EyePosition -> Constructor on type 'System.Single' not found at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
CounterStrikeSharp.API.Modules.Memory.Schema.GetDeclaredClass[T](IntPtr pointer, String className, String memberName) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/Memory/Schema.cs:line 103
CounterStrikeSharp.API.Core.CNetworkViewOffsetVector.get_X() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Schema/Classes/CNetworkViewOffsetVector.g.cs:line 23
TBAntiCheat.Detections.Modules.EyePosition.OnPlayerShoot(PlayerData player) in C:\Users\Oliver\Source\Repos\killerbigpoint\cs2-anticheat\Detections\Modules\EyePosition.cs:line 15
TBAntiCheat.Detections.BaseCaller.OnPlayerShoot(PlayerData player) in C:\Users\Oliver\Source\Repos\killerbigpoint\cs2-anticheat\Detections\BaseCaller.cs:line 58
With a tiny bit of tinkering and realization, it can be fixed by manually calling it with Vector instead as shown below
Hello. I stumbled upon this one problem where trying to get any value out of the ViewOffset field from CCSPlayerPawn is just simply not working. I attached the issue down below with the stacktrace.
X is tested and confirmed to be problematic. Y and Z hasn't been tested but I would assume they would throw the same error
With a tiny bit of tinkering and realization, it can be fixed by manually calling it with Vector instead as shown below
Vector ViewOffset = Schema.GetDeclaredClass<Vector>(playerPawn.Handle, "CBaseModelEntity", "m_vecViewOffset");
Hope this helps!
EDIT: Hopefully more clarify in the error message EDIT 2: Added a possible fix