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

Add these hooks #286

Closed
chycken opened this issue Jan 23, 2024 · 5 comments
Closed

Add these hooks #286

chycken opened this issue Jan 23, 2024 · 5 comments

Comments

@chycken
Copy link

chycken commented Jan 23, 2024

Hello @roflmuffin
Whalin made a weapon restrict plugin for cssharp: https://github.com/CS2Plugins/WeaponRestrict
But if we wanna use this plugin, we have to add these lines to the gamedata file:
"CCSPlayer_CanAcquire": {
"signatures": {
"library": "server",
"windows": "\x48\x8B\xC4\x44\x89\x40\x18\x48\x89\x48\x08\x55\x56",
"linux": "\x55\x48\x89\xE5\x41\x57\x41\x56\x48\x8D\x45\xCC"
}
},
"GetCSWeaponDataFromKey": {
"signatures": {
"library": "server",
"windows": "\x48\x89\x5C\x24\xCC\x48\x89\x74\x24\xCC\x57\x48\x83\xEC\x20\x48\x8B\xFA\x8B",
"linux": "\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x89\xFE\x41\x55\x41\x54\x45"
}
}

So after every cssharp update, we'll have to edit gamedata file too. Can you add these to the cssharp gamedata file by default?

@crashzk
Copy link

crashzk commented Jan 23, 2024

Better yet, it wouldn't be possible, or it would be up to the plugin developer to create a gamedata file for the plugin and simply run it, something like SourceMod, for example, PTaH and others.

This way we are not stuck editing the CSSharp gamedata file, even updating it does not generate errors in plugins and such.

@Whaliin sorry for the ping, just to get your opinion.

@KillStr3aK
Copy link
Contributor

it was implemented in #194

@crashzk
Copy link

crashzk commented Jan 23, 2024

Perfect, now it's with the author of Weapon Restrict so, thanks!

@Whaliin
Copy link

Whaliin commented Jan 23, 2024

Better yet, it wouldn't be possible, or it would be up to the plugin developer to create a gamedata file for the plugin and simply run it, something like SourceMod, for example, PTaH and others.

This way we are not stuck editing the CSSharp gamedata file, even updating it does not generate errors in plugins and such.

@Whaliin sorry for the ping, just to get your opinion.

More hooks should be natively supported by CounterStrikeSharp, but this creates problems with maintainability (updating offsets for example) so I understand why that might not be the case.

CanAcquire is minimally useful but GetCSWeaponDataFromKey is more useful. Of course these would need to be documented as well, if added.

Instead, perhaps it could be documented #194 exists, for example in "Examples" section of the docs. I was not even aware such a method existed until I was pinged with it.

@M1kep
Copy link
Contributor

M1kep commented Jan 24, 2024

Is the GetCSWeaponDataFromKey signature current? I'm having trouble finding on Windows with IDA

@chycken chycken closed this as completed Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants