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] GiveNamedItem parameters are incorrect (?) #466

Open
K4ryuu opened this issue May 26, 2024 · 9 comments
Open

[BUG] GiveNamedItem parameters are incorrect (?) #466

K4ryuu opened this issue May 26, 2024 · 9 comments
Labels
needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration untriaged New issue has not been triaged

Comments

@K4ryuu
Copy link

K4ryuu commented May 26, 2024

GiveNamedItem function returns wrong values to the VirtualFunctions.GiveNamedItemFunc.Hook

In the older versions it also returned the classname properly.

When you purchase and item or give by console cmd with sv_cheats and you log the first three params of the DynamicHook you see this (which is correct):

0. �9�P
1. weapon_m4a1
2. �νP

But when you give an item with GiveNamedItem CSS functions, you see this (and you cannot get the classname of weapon)

0. �9�P
1. @6Y�\U
2. Empty (null)

In my case I want to use the classname for further validations, but its just like not exists if GiveNamedItem is being used to give weapon

The code I added at the first lines of GiveNamedItemFunc.Hook:

for (int i = 0; i < 3; i++)
{
      var paramValue = hook.GetParam<string>(i);
      if (string.IsNullOrWhiteSpace(paramValue))
      {
	      Logger.LogWarning($"{i}. Empty");
      }
      else
      {
	      Logger.LogWarning($"{i}. {paramValue}");
      }
}
@github-actions github-actions bot added the untriaged New issue has not been triaged label May 26, 2024
@ianlucas
Copy link
Contributor

By "older versions" you mean pre-Fire Sale update, right? I also use that hook in one my plugins and updated the signature for CSSharp via #463. Previously the hook was not being triggered as I think we were hooking another function that also gives items (but that is not called when purchasing/receiving items on spawn).

@K4ryuu
Copy link
Author

K4ryuu commented May 28, 2024

It was working completely fine until the latest big update that broke the signs. Since then only the item purchase and console give triggers it well. This could be possibly caused by dynohook in CSS(?), but I'm not sure

@xLeviNx
Copy link
Contributor

xLeviNx commented May 28, 2024

Also I thought we were using offsets for this?

@ianlucas
Copy link
Contributor

We're using offsets for calling GiveNamedItem, but I think memory function hooking currently just works for signatures, that's why CSSharp still maintains the GiveNamedItem signature.

@ianlucas
Copy link
Contributor

It was working completely fine until the latest big update that broke the signs. Since then only the item purchase and console give triggers it well. This could be possibly caused by dynohook in CSS(?), but I'm not sure

Yeah I'm also not sure if this is related to DynoHook, but I'd guess it's not.

@roflmuffin roflmuffin added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jul 27, 2024
Copy link

This issue has been marked needs-author-action and may be missing some important information.

@github-actions github-actions bot removed the untriaged New issue has not been triaged label Jul 27, 2024
@roflmuffin
Copy link
Owner

@K4ryuu Can you confirm if there are still issues with this?

@K4ryuu
Copy link
Author

K4ryuu commented Jul 27, 2024

CleanShot 2024-07-27 at 20 05 46@2x

Weapons are visible again. Perfect job! Issue is solved.
Thanks for your work!

@K4ryuu K4ryuu closed this as completed Jul 27, 2024
@github-actions github-actions bot added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-author-action An issue or pull request that requires more info or actions from the author. labels Jul 27, 2024
@K4ryuu
Copy link
Author

K4ryuu commented Aug 6, 2024

Apologise, but I was wrong with the feedback as I checked on player spawn for some reason. On spawn it works well, but when you use GiveNamedItem, it still returns the following data:

CleanShot 2024-08-07 at 00 55 52@2x

@K4ryuu K4ryuu reopened this Aug 6, 2024
@github-actions github-actions bot added the untriaged New issue has not been triaged label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

4 participants