What is the difference between QueryClientConVar and GetClientInfo and?
I'm trying to understand the difference between the two, and possibly the underlying difference.
API
QueryClientConVar
API
GetClientInfo
Source for QueryClientConVar
PHP Code:
static cell_t sm_QueryClientConVar(IPluginContext *pContext, const cell_t *params)
{
CPlayer *pPlayer;
char *name;
IPluginFunction *pCallback;
if (!g_ConVarManager.IsQueryingSupported())
{
if (!s_QueryAlreadyWarned)
{
s_QueryAlreadyWarned = true;
return pContext->ThrowNativeError("Game does not support client convar querying (one time warning)");
}
return 0;
}
pPlayer = g_Players.GetPlayerByIndex(params[1]);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", params[1]);
}
if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not connected", params[1]);
}
/* Trying a query on a bot results in callback not be fired, so don't bother */
if (pPlayer->IsFakeClient())
{
return 0;
}
pContext->LocalToString(params[2], &name);
pCallback = pContext->GetFunctionById(params[3]);
if (!pCallback)
{
return pContext->ThrowNativeError("Invalid function id (%X)", params[3]);
}
return g_ConVarManager.QueryClientConVar(pPlayer->GetEdict(), name, pCallback, params[4]);
}
Source for GetClientInfo
PHP Code:
static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not connected", client);
}
char *key;
pContext->LocalToString(params[2], &key);
const char *val = engine->GetClientConVarValue(client, key);
if (!val)
{
return false;
}
pContext->StringToLocalUTF8(params[3], params[4], val, NULL);
return 1;
}
QueryClientConVar calls QueryClientConVar with a callback
GetClientInfo calls GetClientConVarValue without callback
__________________