AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Client info changed (https://forums.alliedmods.net/showthread.php?t=82378)

butthead 12-22-2008 07:35

Client info changed
 
Help me plz,

this problem:

PHP Code:

public client_infochanged(id) {
    
    if (!
is_user_connected(id))
        return 
PLUGIN_CONTINUE;
    
    
query_client_cvar(id"cl_sidespeed""ClientCvarResult")
   
    return 
PLUGIN_CONTINUE;
}

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

    new 
name[32]
    
    
get_user_name(idname31)

    if(
value[id] > 400// < --- line 153
        
log_amx("Check sidespeed change : Nick %s /// change to value: %s"namevalue)
    return 
PLUGIN_CONTINUE;


Error:
PHP Code:

L 12/22/2008 13:33:01: [AMXXRun time error 5memory access 
L 12
/22/2008 13:33:01: [AMXX]    [0plugin.sma::ClientCvarResult (line 153

Thx

L// 12-22-2008 08:40

Re: Client info changed
 
change this...

Code:

if(value[id] > 400)
for this...

Code:

if(str_to_num(value) > 400)
and compile

butthead 12-22-2008 17:37

Re: Client info changed
 
Thanks very much, otherwise "client_infochanged" is not a good idea, and i have problem with "FM_PlayerPreThink", poorly written in the logs, roughly 20 lines the same. What is "FM_CVarGetString" ? Or where is problem?

Exolent[jNr] 12-22-2008 17:41

Re: Client info changed
 
I doubt client_infochanged is called when a client changes cvars.

butthead 12-22-2008 17:52

Re: Client info changed
 
Responds as if I change the nick...

alien 12-22-2008 20:34

Re: Client info changed
 
Hi butthead ...
client_infochanged is called, when a client changes something in 'info' structure (see 'setinfo' console command) that is not purely client-side.

butthead 12-23-2008 05:27

Re: Client info changed
 
Hi alien, thx I understand ... but I need to fix client cheats (cl_sidespeed, developer, fps_max), just for these cvars responds only to change 'info' structure...

Trying another way.. It may be as follows?
PHP Code:

public client_putinserver(id) {

    new 
param[1];param[0] = id
   
    set_task
(3.0"checkCvars"idparam1"b")

public 
checkCvars(param[]) {

    new 
id param[0]
    
    if(!
is_user_alive(id)) {
        return
    }    
    
    
query_client_cvar(id"cl_sidespeed""ClientCvarResult")
    
query_client_cvar(id"developer""ClientCvarResult")
    
query_client_cvar(id"fps_max""ClientCvarResult")    

}

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

    new 
name[32], auth[32]
    
    
get_user_name(idname31)
    
get_user_authid(idauth31)
    
    if(
equal(cvar"cl_sidespeed") && str_to_num(value) != 400) {
        
        
log_amx("Check sidespeed change >>>> Nick: %s / steam id: %s /// change to value: %s"nameauthvalue)
        
client_cmd(id,"cl_sidespeed 400")

    }
    if(
equal(cvar"developer") && str_to_num(value) != 0) {
        
        
log_amx("Check developer change >>>> Nick: %s / steam id: %s /// change to value: %s"nameauthvalue)
        
client_cmd(id,"developer 0")

    }
    if(
equal(cvar"fps_max") && str_to_num(value) != 101) {
        
        
log_amx("Check fps_max change >>>> Nick: %s / steam id: %s /// change to fps_max: %s"nameauthvalue)
        
client_cmd(id,"fps_max 101")

    }

    return 
PLUGIN_CONTINUE
}



alien 12-26-2008 22:30

Re: Client info changed
 
I'm not really into query_client_cvar.
First, it's resource expensive and slow method.
Second, it's asynchronous ... what's not that bad really.
Third and most important reason is that you need to call it really frequently to make it efficient for what you're doing. If you want to protect your KZ server from people using edge bugs with ease @ 20 fps, 3 sec is not enough. You can bind "fps_max 20" to a mouse key, use it just before hitting the edge and plugin will turn it off after 3 secs what's more than enough time to exploit. Calling it with 1 sec interval wouldn't be enough.

The most effective method I've came across is using aliases to block certain client cvars in combination with query_client_cvar, which is called once though. Only downfall is that for aliases to wear off, users need to restart the game.


All times are GMT -4. The time now is 09:16.

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