Raised This Month: $51 Target: $400
 12% 

best performance method to query client cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-01-2012 , 10:17   best performance method to query client cvar
Reply With Quote #1

what would be the best performance friendly method to query client cvars ?

in example you can think about When to query and check cvars.
- on events vs set_task or vs get_gametime? or is it possible on get_user_aiming, something else ?

what checks to set before comparing the cvar value like.
- is_user_alive, is_user_hltv, is_user_bot

are there more ways how to check besides query_client_cvar?
get_cvar_string?
vamppa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-01-2012 , 13:39   Re: best performance method to query client cvar
Reply With Quote #2

get_user_aiming() is a function, not a forward or event. You need to be more specific about what exactly you are trying to do (less vague). Also, get_cvar_string() is for server-side cvars.
__________________
fysiks is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-01-2012 , 14:12   Re: best performance method to query client cvar
Reply With Quote #3

what im trying to do is checking client cvars on the most lag free way.
am gathering knowledge before I wanted to start.
did some searching, programming n testing
so far I got
PHP Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init() 
{
    
register_plugin"query cvar test" "1.0" "vamp" );
    
register_event"ItemPickup""age_check_all_users_cvars""b");
}
public 
client_putinserver(id
{
   
check_specific_user_cvars(id);
   return 
PLUGIN_CONTINUE;
}
public 
age_cvar_check_fps_max(id, const szCvar, const szValue[]) 
{          
   new 
Float:fValue str_to_float(szValue);
   if( 
fValue 125.0 ) {  
   new 
name[32];
   
get_user_name(id,name,31);
   
client_print(0,print_chat,"Ehll - %s has been kicked for having more then 125 fps !"name);
   
server_cmd("kick #%d for having more then 125 fps !"get_user_userid(id));
  }
}
public 
Netcvarid , const cvar[], const szrValue[])
{
   
client_printprint_chat "value=%s" szrValue );  
}
public 
check_specific_user_cvars(id
{
   
query_client_cvarid "fps_max" "age_cvar_check_fps_max" );
   
query_client_cvarid "fps_modem" "age_cvar_check_fps_max" );
   
query_client_cvarid "cl_cmdrate" "Netcvar" );
   return 
PLUGIN_CONTINUE;
}
public 
age_check_all_users_cvars () 
{
   new 
players[32], numplayersid;
   
get_players playersnumplayers );
   for ( new 
i=0i<numplayersi++ ) {
   
id=players[i];
   
check_specific_user_cvarsid );
  }

the idea: if a client cvar has the wrong value he/she will get kicked.
for fps_max good values would be 60,72,100,125.
right now I use the > but it should all be = 60,72,100,125 otherwise kick
so nobody would be able to use 81.3 fps or 250fps during a clanwar.

Last edited by vamppa; 06-01-2012 at 15:47.
vamppa is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 06-01-2012 , 19:54   Re: best performance method to query client cvar
Reply With Quote #4

PHP Code:
#include <amxmodx>

#define PLUGIN "Rates Check"
#define VERSION "1.0"
#define AUTHOR "[R]ak"

new Trie:Cvars
public plugin_init()
    
register_plugin(PLUGINVERSIONAUTHOR)

public 
plugin_cfg() {
    
Cvars TrieCreate()
    
TrieSetString(Cvars"rate""25000")
    
TrieSetString(Cvars"cl_updaterate""101")
    
TrieSetString(Cvars"cl_cmdrate""101")
}
public 
client_connect(id) { 
    if (!
is_user_bot(id)) {
        
query_client_cvar(id"rate""Cvar_Result")
        
query_client_cvar(id"cl_updaterate""Cvar_Result")
        
query_client_cvar(id"cl_cmdrate""Cvar_Result")
    }
        


public 
Cvar_Result(id, const cvar[], const value[]) { 
    static 
value_check[6]
    
    
TrieGetString(Cvarscvarvalue_checkcharsmax(value_check))
    
    if(!
equal(valuevalue_check))
        
server_cmd("kick #%d ^"If you would enter to the server needs this ratesrate 25000cl_updaterate 101cl_cmdrate 101^""get_user_userid(id))

__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-05-2012 , 08:17   Re: best performance method to query client cvar
Reply With Quote #5

thanks
how would I check a value 4 times if it is equal to a number?

PHP Code:
if(equal(value125))
return 
PLUGIN_CONTINUE;

if(
equal(value100))
return 
PLUGIN_CONTINUE;

if(
equal(value72))
return 
PLUGIN_CONTINUE;

if(
equal(value60))
return 
PLUGIN_CONTINUE;

else 
server_cmd("kick #%d for having illegal fps value !"get_user_userid(id)); 
vamppa is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-05-2012 , 13:38   Re: best performance method to query client cvar
Reply With Quote #6

PHP Code:

switch (value) {
  case 
6072100125: {
    return 
PLUGIN_CONTINUE;
  }
  default: {
    
server_cmd("kick #%d for having illegal fps value !"get_user_userid(id));
  }

jimaway is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 06-05-2012 , 17:08   Re: best performance method to query client cvar
Reply With Quote #7

PHP Code:
public Cvar_Result(id, const cvar[], const value[]) { 
    new 
iValue str_to_num(value)
    
    if(
iValue 125)
        
server_cmd("kick #%d for having illegal fps value !"get_user_userid(id))
        

__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
feren02
Senior Member
Join Date: Mar 2012
Old 04-29-2021 , 06:06   Re: best performance method to query client cvar
Reply With Quote #8

What if the cvar was aliased?

For example:
they typed /rate 99999
then
alias rate

What will happen with the query_client_cvar?


Thanks!
feren02 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-29-2021 , 22:49   Re: best performance method to query client cvar
Reply With Quote #9

Aliases are for the console so I suspect that it won't prevent the query from working. I'd recommend trying it and seeing what happens.
__________________
fysiks is offline
Reply



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


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