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

is there like a "OnClientCommand" #580

Open
2vg opened this issue Sep 24, 2024 · 1 comment
Open

is there like a "OnClientCommand" #580

2vg opened this issue Sep 24, 2024 · 1 comment
Labels
untriaged New issue has not been triaged

Comments

@2vg
Copy link

2vg commented Sep 24, 2024

I didn't know how to catch the event when the client sends the command.
What I want to do is that there are times when I need to set sv_cheats to 1 for some cvars that the map changes on its own, so I want to catch such an event and temporarily enable sv_cheats. (This is mainly useful on minigame maps)
At first, I thought of catching the server_cvar event, but if sv_cheats is disabled, cvar is not changed, so no event is issued, so I could not catch it.
I wish there was something like OnClientCommand, but if there is another way please let me know, Thanks!

@github-actions github-actions bot added the untriaged New issue has not been triaged label Sep 24, 2024
@2vg
Copy link
Author

2vg commented Sep 26, 2024

okey, i was finally able to accomplish what i wanted on my own.
even if remove the cheat flag from the cvar, the FakeConvar system will still detect the cheat flag so this solution is not useful.
Also, for some reason EntityOutputHook for point_servercommand and logic_auto does not work.
like this:

[EntityOutputHook("point_servercommand(or, logic_auto)", "*")]
public HookResult OnHook(CEntityIOOutput output, string name, CEntityInstance activator, CEntityInstance caller, CVariant value, float delay)
{
    Logger.LogInformation("[EntityOutputHook Attribute] point_servercommand with ({name}, {activator}, {caller}, {delay})", name, activator.DesignerName, caller.DesignerName, delay);

    return HookResult.Continue;
}

in the end, i decided to put a hook on all entities and check the output target type.
i may be doing something wrong or there may be another way, so i will leave the issue open for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

1 participant