Raised This Month: $32 Target: $400
 8% 

cvar_result_func


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 04-10-2019 , 08:35   cvar_result_func
Reply With Quote #1

Is there any way to get client cmd values (more than 1 cmd)?
What I want to do is check each client's "rate" "ex_interp" info and print it out accordingly, but I can only have just one cvar_result_func with just one value which is either rate or ex_interp, I can't have both of them can I?

The code I got so far
PHP Code:
public cmd_BigInfo(id)
{
    if(!
is_user_connected(id))
        return 
PLUGIN_HANDLED;

    new 
playa id
    console_print
(id"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
    
console_print(id"Nume       STEAMID       INTERP       PLAYTIME       RATE")
    new 
players[32], player
    
for (new i=0i<g_iMaxPlayersi++)
    {
    
player players[i]
        if(!
is_user_connected(player))
            return 
PLUGIN_CONTINUE;
    
query_client_cvar(player"ex_interp""cvar_result_func")
    }

    return 
PLUGIN_HANDLED;
}

public 
cvar_result_func(id, const cvar[], const value[]) {

    new 
PlayerName[32];
    new 
STEAM_ID[32];
    new 
PlayTime;
    
get_user_name(idPlayerName31)
    
get_user_authid(idSTEAM_ID31)
    
get_user_time(idPlayTimesizeof(PlayTime))


    
console_print(playa"%s  -  %s   -   %s   -   %s"nameauthidvalueplayime);
    
    return 
PLUGIN_CONTINUE;

__________________

Last edited by deprale; 04-10-2019 at 08:36.
deprale is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 04-10-2019 , 10:14   Re: cvar_result_func
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=50923
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-10-2019 , 11:43   Re: cvar_result_func
Reply With Quote #3

What is stopping you from making 2 calls to query_client_cvar with different client cvars?
__________________
HamletEagle is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 04-10-2019 , 13:08   Re: cvar_result_func
Reply With Quote #4

Hmm, I just didn't know how to go around doing that @HamletEagle, It can only store one value for each player right? How would I display first ex_interp value, then get rate value, do I pass it in the same constant which is value? Won't it get messed up?

EDIT: Thanks SomewhereLost, that src helped a lot, I managed to do what I wanted to.
__________________

Last edited by deprale; 04-10-2019 at 13:09.
deprale is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-10-2019 , 22:12   Re: cvar_result_func
Reply With Quote #5

FYI, you can force "rate" and "cl_updaterate" on clients by setting the following cvars on the server:

sv_minrate
sv_maxrate
sv_minupdaterate
sv_maxupdaterate

If you query the cvar, you will probably get their cvar value and not the value that is actually being used if it was coerced by the settings shown above.
__________________
fysiks is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 04-18-2019 , 12:46   Re: cvar_result_func
Reply With Quote #6

thats actually super useful, thanks fysiks
__________________
deprale 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 18:54.


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