AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cvar changing msgs were sent to clients frequently (https://forums.alliedmods.net/showthread.php?t=134606)

hzqst 08-07-2010 02:56

Cvar changing msgs were sent to clients frequently
 
I use
PHP Code:

public Accelerate_Fix(){
 
set_cvar_num("sv_accelerate"10)
 
set_task(0.1"Accelerate_Fix")


to prevent sv_accelerate from changing by game and works fine,but
a lot of messages could be seen in client's console like :
Quote:

"sv_accelerate" changed to "5"
"sv_accelerate" changed to "10"
"sv_accelerate" changed to "5"
"sv_accelerate" changed to "10"
....
It caused overflow, sometimes most clients were kicked by reason " "
How to prevent it from overflowing or block suck these messages?

infek 08-07-2010 03:53

Re: Cvar changing msgs were sent to clients frequently
 
not sure if it will work but try this
PHP Code:

#include <amxmodx>

new aa;
public 
plugin_init() {
    
register_plugin"Acceleration""0.1""iNfek" )
    
    
aa get_cvar_pointer"sv_accelerate" )
}

public 
plugin_cfg( ) {
    
set_cvar_string"sv_accelerate""10" )
}

public 
AA( ) {
    if( 
aa 10 )
    {
        
server_cmd"sv_accelerate 10" )
    }
    if( 
aa 10 )
    {
        
server_cmd"sv_accelerate 10" )
    }



Hunter-Digital 08-07-2010 09:44

Re: Cvar changing msgs were sent to clients frequently
 
get_cvar_pointer() returns just a POINTER, you need to use set/get_pcvar_*(pointer, ...), it doesn't hold and update the value... also, the AA() function won't trigger because it's not called anywhere.

You *could* use set_pcvar_num(), I think that doesn't trigger the console messages... however, this is much more efficient: http://forums.alliedmods.net/showthread.php?t=120866

hzqst 08-08-2010 01:33

Re: Cvar changing msgs were sent to clients frequently
 
thanks works fime


All times are GMT -4. The time now is 00:07.

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