AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Overflowing (https://forums.alliedmods.net/showthread.php?t=187827)

kileedyg 06-18-2012 13:36

Overflowing
 
PHP Code:

#include <amxmodx>
new Trie:Cvars
#define AMOUNT 152

new const g_komandos[AMOUNT][] = 
{
"kzh_bhop",
//and 151 so that i don't want to show.... w/o value
}

public 
plugin_cfg() {
    
Cvars TrieCreate()
    for (new 
0AMOUNTi++) 
    
TrieSetCell(Cvarsg_komandos[i], i+1)    
}

public 
client_connect(id) { 
    if (
is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id)) {
    for (new 
0AMOUNTi++)
    
query_client_cvar(idg_komandos[i],"Cvar_Result")
    }
}
public 
client_disconnect(id) {
    
remove_task(id)
}
public 
Cvar_Result(id, const cvar[], const value[]) { 
    static 
value_check[6]
    
    
TrieGetString(Cvarscvarvalue_checkcharsmax(value_check))
    
    if(!
equal(valuevalue_check))
    
veiksmas(id)
}
public 
veiksmas(id) {
    
server_cmd("kick #%d ^"blabla^""get_user_userid(id))
    
//server_cmd("amx_ban 40320 #%d ^"blabla^"", get_user_userid(id)) 

first of all i getting overflow, couse theres much g_komandos = cvars, second i want specify reason to every cvar,thanks

the error in client console
server logs: none, tryed to debug plugin: none

Quote:

myserverip:myserverport:Outgoing message overflow

dFF 06-18-2012 15:29

Re: Overflowing
 
Try to use a delay in client_connect or use query_client_cvar in Ham_Spawn post.

kileedyg 06-19-2012 10:14

Re: Overflowing
 
Quote:

Originally Posted by dFF (Post 1731221)
Try to use a delay in client_connect or use query_client_cvar in Ham_Spawn post.


more than 4x cvars i can't check, even cycled it ,also used as you said a delay and ham spawn still..

Exolent[jNr] 06-19-2012 12:41

Re: Overflowing
 
It's because you are querying them all at once. Do one at a time.

kileedyg 06-19-2012 13:41

Re: Overflowing
 
Quote:

Originally Posted by Exolent[jNr] (Post 1731734)
It's because you are querying them all at once. Do one at a time.

show me example, please...

ConnorMcLeod 06-19-2012 16:09

Re: Overflowing
 
Again, the method is not efficient, but if you still want to use i you can use my old plugin.
Add all cvars in a file, pay attention to not put 2 cvars twice.

Quote:

Originally Posted by amxmodx/configs/hacks_prefixes.ini
"kzh_bhop"
"zhy_bhop"
"kyk_bhop"
"kxk_bhop"
"xhz_bhop"
"yhz_bhop"
"v0n_bhop"
"xyz_bhop"
"kid_bhop"
"fpt_bhop"
"fuh_bhop"
"omg_bhop"
"voo_bhop"
"xHack_bhop"
"xKz_bhop"
"xkz_bhop"
"001_bhop"
"002_bhop"
"Trk_bhop"
"m3c_bhop"
"m4c_bhop"
"zhyk_bhop"
"xcfgbhop"
"zhe_bhop"
"^^_^^<bhop"
"n1k<bhop"
"nkz_bhop"
"nik_bhop"
"str_bhop"
"vip_bhop"
"xhack_bhop"

etc...


PHP Code:

#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "KZH Checker"

enum _:playerTasks ( += 33 )
{
    
CVAR_CHECKER,
    
}

new 
g_szFirstCvar[32]
new 
Trie:g_tNextCvar
new g_pCvarBanTime

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarBanTime register_cvar("kz_hack_bantime""0")

    new 
szCvarsFile[128], szOldCvar[32], szNewCvar[32]
    
get_localinfo("amxx_configsdir"szCvarsFilecharsmax(szCvarsFile))
    
add(szCvarsFilecharsmax(szCvarsFile), "/hacks_prefixes.ini")
    new 
fp fopen(szCvarsFile"rt")
    if( 
fp && file_size(szCvarsFile1) >= )
    {
        
g_tNextCvar TrieCreate()
        while( !
feof(fp) )
        {
            
fgets(fpszNewCvarcharsmax(szNewCvar))
            
trimszNewCvar )
            
remove_quotesszNewCvar )
            if( 
szOldCvar[0] && TrieKeyExists(g_tNextCvarszOldCvar) )
            {
                
TrieSetString(g_tNextCvarszOldCvarszNewCvar)
            }
            else
            {
                
copy(g_szFirstCvarcharsmax(g_szFirstCvar), szNewCvar)
            }
            
copy(szOldCvarcharsmax(szOldCvar), szNewCvar)
        }
        
TrieSetString(g_tNextCvarszOldCvarg_szFirstCvar)
    }
    if( 
fp )
    {
        
fclosefp )
    }
}

public 
client_putinserverid )
{
    
remove_task(id CVAR_CHECKER)
    if( !
is_user_bot(id) && !is_user_hltv(id) )
    {
        if( 
g_tNextCvar )
        {
            
set_task(0.1"Task_CheckCheatCvar"id CVAR_CHECKER)
        }
    }
}

public 
Task_CheckCheatCvar(id)
{
    
id %= 33
    
if( is_user_connected(id) )
    {
        
query_client_cvar(idg_szFirstCvar"ClientCvarResult")
    }
}

public 
ClientCvarResult(id, const szCvar[], const szValue[])
{
    if( 
is_user_connected(id) )
    {
        if( 
szValue[0] != 'B' )
        {
            new 
szName[32], szAuthid[32], szReason[14]
            if( 
equal(szCvar"kzh"3) )
            {
                
szReason "KZHack"
            
}
            else
            {
                
szReason "KZHack Custom"
            
}

            
get_user_name(idszNamecharsmax(szName))
            
get_user_authid(idszAuthidcharsmax(szAuthid))

            
server_cmd("amx_ban ^"%s^" %d ^"%s^""szAuthidget_pcvar_num(g_pCvarBanTime), szReason)
        }
        static 
szNextCvar[9]
        if( 
TrieGetString(g_tNextCvarszCvarszNextCvarcharsmax(szNextCvar)) )
        {
            
query_client_cvar(idszNextCvar"ClientCvarResult")
        }
    }



kileedyg 06-20-2012 05:46

Re: Overflowing
 
Quote:

Originally Posted by ConnorMcLeod (Post 1731888)
Again, the method is not efficient, but if you still want to use i you can use my old plugin.
Add all cvars in a file, pay attention to not put 2 cvars twice.



etc...


PHP Code:

#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "KZH Checker"

enum _:playerTasks ( += 33 )
{
    
CVAR_CHECKER,
    
}

new 
g_szFirstCvar[32]
new 
Trie:g_tNextCvar
new g_pCvarBanTime

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarBanTime register_cvar("kz_hack_bantime""0")

    new 
szCvarsFile[128], szOldCvar[32], szNewCvar[32]
    
get_localinfo("amxx_configsdir"szCvarsFilecharsmax(szCvarsFile))
    
add(szCvarsFilecharsmax(szCvarsFile), "/hacks_prefixes.ini")
    new 
fp fopen(szCvarsFile"rt")
    if( 
fp && file_size(szCvarsFile1) >= )
    {
        
g_tNextCvar TrieCreate()
        while( !
feof(fp) )
        {
            
fgets(fpszNewCvarcharsmax(szNewCvar))
            
trimszNewCvar )
            
remove_quotesszNewCvar )
            if( 
szOldCvar[0] && TrieKeyExists(g_tNextCvarszOldCvar) )
            {
                
TrieSetString(g_tNextCvarszOldCvarszNewCvar)
            }
            else
            {
                
copy(g_szFirstCvarcharsmax(g_szFirstCvar), szNewCvar)
            }
            
copy(szOldCvarcharsmax(szOldCvar), szNewCvar)
        }
        
TrieSetString(g_tNextCvarszOldCvarg_szFirstCvar)
    }
    if( 
fp )
    {
        
fclosefp )
    }
}

public 
client_putinserverid )
{
    
remove_task(id CVAR_CHECKER)
    if( !
is_user_bot(id) && !is_user_hltv(id) )
    {
        if( 
g_tNextCvar )
        {
            
set_task(0.1"Task_CheckCheatCvar"id CVAR_CHECKER)
        }
    }
}

public 
Task_CheckCheatCvar(id)
{
    
id %= 33
    
if( is_user_connected(id) )
    {
        
query_client_cvar(idg_szFirstCvar"ClientCvarResult")
    }
}

public 
ClientCvarResult(id, const szCvar[], const szValue[])
{
    if( 
is_user_connected(id) )
    {
        if( 
szValue[0] != 'B' )
        {
            new 
szName[32], szAuthid[32], szReason[14]
            if( 
equal(szCvar"kzh"3) )
            {
                
szReason "KZHack"
            
}
            else
            {
                
szReason "KZHack Custom"
            
}

            
get_user_name(idszNamecharsmax(szName))
            
get_user_authid(idszAuthidcharsmax(szAuthid))

            
server_cmd("amx_ban ^"%s^" %d ^"%s^""szAuthidget_pcvar_num(g_pCvarBanTime), szReason)
        }
        static 
szNextCvar[9]
        if( 
TrieGetString(g_tNextCvarszCvarszNextCvarcharsmax(szNextCvar)) )
        {
            
query_client_cvar(idszNextCvar"ClientCvarResult")
        }
    }




fabulous mr connor, i will use this! also whats the efficient method? :)


All times are GMT -4. The time now is 06:11.

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