OnQueryCvarValueFinished never gets called
Hi,
I'm writing an extension and I'm trying to get client's cvar. When I called engine->GetClientConVarValue(...), I got empty string. I've expected this since the cvar is quite unusual. Now I'm calling engine->StartQueryCvarValue(...), I get valid cookie, but OnQueryCvarValueFinished never gets called! I have it hooked the same way as sourcemod does it: Code:
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *); Have you encountered such issue? Thanks! |
Re: OnQueryCvarValueFinished never gets called
Skimming the SM code, it appears you're hooking the wrong interface, at least. SM hooks it on IServerPluginCallbacks when the engine is not ep1.
|
Re: OnQueryCvarValueFinished never gets called
Thanks!
Switched to IServerPluginCallbacks::OnQueryCvarValueFinis hed and to IServerPluginHelpers::StartQueryCvarValue, and it workes like a charm! :) When we're at it - is there any way how to be notified when client changes this cvar? Or any cvar at all, just so I don't have to poll this information all the time? |
Re: OnQueryCvarValueFinished never gets called
If the ConVar has the userinfo flag set on it, you can use GetClientConVarValue and watch for changed by hooking IServerGameClients::ClientSettingsChanged.
If it does not, you have to poll the way you're doing now, with no direct way to get notified of changes. You can find a list of these vars by issuing "findflags userinfo" in the client console. |
Re: OnQueryCvarValueFinished never gets called
Thanks for the findflags userinfo hint. As expected, the cvar has not the flag set, but polling from time to time works just fine. :)
|
All times are GMT -4. The time now is 11:22. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.