Raised This Month: $170 Target: $400
 42% 

OnQueryCvarValueFinished never gets called


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 02-06-2018 , 18:02   OnQueryCvarValueFinished never gets called
Reply With Quote #1

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 *);

bool CExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late) {
	SH_ADD_HOOK(IServerGameDLL, OnQueryCvarValueFinished, gamedll, SH_MEMBER(this, &CExtension::OnQueryCvarValueFinished), false);
}
I've tried different cvars without any luck. I'm testing this in csgo.

Have you encountered such issue?

Thanks!
__________________
Sorry for my english.
Backup is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 02-06-2018 , 22:33   Re: OnQueryCvarValueFinished never gets called
Reply With Quote #2

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.
Fyren is offline
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 02-07-2018 , 04:38   Re: OnQueryCvarValueFinished never gets called
Reply With Quote #3

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?
__________________
Sorry for my english.
Backup is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-07-2018 , 13:24   Re: OnQueryCvarValueFinished never gets called
Reply With Quote #4

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.

Last edited by psychonic; 02-07-2018 at 13:24.
psychonic is offline
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 02-08-2018 , 05:48   Re: OnQueryCvarValueFinished never gets called
Reply With Quote #5

Thanks for the findflags userinfo hint. As expected, the cvar has not the flag set, but polling from time to time works just fine.
__________________
Sorry for my english.
Backup is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:38.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode