Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] CNetworkViewOffsetVector doesn't seem to be working properly #482

Closed
killerbigpoint opened this issue Jun 6, 2024 · 2 comments
Closed
Labels
area-API-SchemaSystem Related to the Source 2 Schema System

Comments

@killerbigpoint
Copy link

killerbigpoint commented Jun 6, 2024

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

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

@github-actions github-actions bot added the untriaged New issue has not been triaged label Jun 6, 2024
@necuk
Copy link

necuk commented Jul 15, 2024

faced the same problem, using the proposed solution for now

@roflmuffin
Copy link
Owner

CNetworkViewOffsetVector should now have the correct float properties in v252, if you could try this version and let me know if you have any issues with it.

@roflmuffin roflmuffin added area-API-SchemaSystem Related to the Source 2 Schema System and removed untriaged New issue has not been triaged labels Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-API-SchemaSystem Related to the Source 2 Schema System
Projects
None yet
Development

No branches or pull requests

3 participants