Query client cvar
-
- Junior Member
- Posts: 11
- Joined: Wed Apr 27, 2016 11:54 am
Query client cvar
Is it possible to query a client cvar? In sourcemod the command is QueryClientConVar, i tried to find in the documentation, but i don't think there is a function for it. Is there any alternative to do it?
Re: Query client cvar
This might work?
Edit: fixed my misunderstanding of how convar querying works
Syntax: Select all
from engines.server import engine_server
from entities.helpers import edict_from_index
from listeners import OnQueryCvarValueFinished
def query_player_convar(index, cvar_name):
edict = edict_from_index(index)
engine_server.start_query_cvar_value(edict, cvar_name)
@OnQueryCvarValueFinished
def on_query_cvar_value_finished(cookie, index, status, cvar_name, cvar_value):
print("Value: {}".format(cvar_value))
Edit: fixed my misunderstanding of how convar querying works

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: Query client cvar
Not your fault, the docstring of that method is very mis-leading. I will try to update it soon.iPlayer wrote:Edit: fixed my misunderstanding of how convar querying works
-
- Junior Member
- Posts: 11
- Joined: Wed Apr 27, 2016 11:54 am
Re: Query client cvar
Thank you, this is it. 

Re: Query client cvar
L'In20Cible wrote:Not your fault, the docstring of that method is very mis-leading. I will try to update it soon.iPlayer wrote:Edit: fixed my misunderstanding of how convar querying works
What does that method return though? An integer called "cookie"? If so, I believe this cookie might prove very useful to determine what query we are serving in OnQueryCvarValueFinished listener.
marcowmadeira wrote:Thank you, this is it.
No problem, and welcome to the community

Last edited by iPlayer on Thu Nov 03, 2016 3:04 pm, edited 1 time in total.

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: Query client cvar
Yup, the cookie returned is to be compared into the listener. Only useful if the tasks you want to achieve need to be performed only once otherwise comparing the convar name does it just fine even though your code runs whenever any plugin is querying the said convar name.
We may consider adding a Player.query_convar(<cvar name>, <callback>) in the future.
We may consider adding a Player.query_convar(<cvar name>, <callback>) in the future.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 55 guests