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

EventBuymenuOpen Missing Userid / CCSPlayerController #533

Closed
RealGoodAidan opened this issue Jul 29, 2024 · 4 comments
Closed

EventBuymenuOpen Missing Userid / CCSPlayerController #533

RealGoodAidan opened this issue Jul 29, 2024 · 4 comments
Labels
area-API-GameEvents needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration

Comments

@RealGoodAidan
Copy link

According to the docs, EventBuymenuOpen should have the User instance. However, it's missing:

public class EventBuymenuOpen : GameEvent

EventBuymenuClose has it:

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

roflmuffin commented Jul 30, 2024

Hey, we generate the game event classes based on the contents of the game events file in the vpk file, as seen below. This doesn't seem to have the userid defined.

Do you know if the value is valid if you do a manual .Get<CCSPlayerController> on the event instance?

https://github.com/SteamDatabase/GameTracking-CS2/blob/9e73a086d6ecae1620e3ee94ade2fbb983d7499d/game/csgo/pak01_dir/resource/mod.gameevents#L396

@roflmuffin roflmuffin added area-API-GameEvents needs-author-action An issue or pull request that requires more info or actions from the author. and removed untriaged New issue has not been triaged labels Jul 30, 2024
Copy link

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

@RealGoodAidan
Copy link
Author

RealGoodAidan commented Jul 30, 2024

@roflmuffin I tried, but the hook doesn't seem to be working. I don't see my HERE log statement. I've tried both Pre/Post hooks. Maybe I'm doing something dumb.

[GameEventHandler(HookMode.Pre)]
    public HookResult OnBuymenuOpenPost(EventBuymenuOpen @event, GameEventInfo info)
    {
        Logger.LogInformation("HERE");
        Logger.LogInformation("{player} has opened the buy menu", @event.Get<CCSPlayerController>("userid").PlayerName);
        return HookResult.Continue;
    }

edit: Also tried manually registering the event handler in my Load function, still don't see any logs:

RegisterEventHandler<EventBuymenuOpen>((@event, info) =>
        {
            Logger.LogInformation("HERE");
            Logger.LogInformation("{player} has opened the buy menu", @event.Get<CCSPlayerController>("userid").PlayerName);
            return HookResult.Continue;
        });

@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 30, 2024
@RealGoodAidan
Copy link
Author

RealGoodAidan commented Jul 30, 2024

Searching in your discord, getting the player who opened the buy menu just isn't possible: https://discord.com/channels/1160907911501991946/1160907912445710480/1197209710277963867

Which is really weird in my opinion because the action is so user-specific (and it's provided in the buymenu close event lol), but obviously nothing you can do about it.

The hook itself still seems broken since I can get any log statements, but closing as the original issue is resolved.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-API-GameEvents needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Projects
None yet
Development

No branches or pull requests

2 participants