Raised This Month: $ Target: $400
 0% 

Difference between QueryClientConVar and GetClientInfo


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 12-18-2019 , 11:47   Difference between QueryClientConVar and GetClientInfo
Reply With Quote #1

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(), namepCallbackparams[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(clientkey);
    if (!
val)
    {
        return 
false;
    }

    
pContext->StringToLocalUTF8(params[3], params[4], valNULL);
    return 
1;

QueryClientConVar calls QueryClientConVar with a callback
GetClientInfo calls GetClientConVarValue without callback
__________________

Last edited by ImACow; 12-18-2019 at 11:48.
ImACow is offline
 



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 13:11.


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