AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Double command using problem[anti-fastfire+advanced_bans] (https://forums.alliedmods.net/showthread.php?t=85948)

Metanabol 02-18-2009 09:15

Double command using problem[anti-fastfire+advanced_bans]
 
Hello i slightly edited ant_fastfire 1.2v for working with advanced bans. But script for fast fire bans 2 times, sometimes 3times... so my question is how to stop this command for banned player, after advanced_bans banip for 1 hour ?:) here is code:

PHP Code:

public checkBulletCount()
{
    if (
get_cvar_num("amx_af") == 1)
    {
        for(new 
i=1;i<=g_MaxPlayers;i++)
        {
            if(
is_user_alive(i))
            {
                
//client_print(i,print_chat,"%i",countBullets[i])
                
if (countBullets[i] > get_cvar_num("amx_af_max"))
                {
                    new 
Authid[35],Name[32],CurrentTime[29],Map[32],ping,loss,Message[256]
                    
//client_print(0,print_chat,"%i",countBullets[i])
                    
get_user_name(i,Name,31)
                    
get_user_authid(i,Authid,34)
                    
get_mapname(Map,31)
                    
get_user_ping(i,ping,loss)
                    
get_time("%d/%m-%Y - %H:%M:%S",CurrentTime,29)
                    
                    
format(Message,255,"[Anti FastFire %s - %s] %s<%s> using FastFire type of cheat (Ping: %d )",CurrentTime,Map,Name,Authid,ping)
                    
log_amx(Message)

                    
client_print(0print_chat"%s booted by AF plugin.",Name)

                    if (
get_cvar_num("amx_af") == 1)
                    {
                        
server_cmd("amx_banip #%d 60 ^"[AC]FAST-FIRE Detected.^"",get_user_userid(i))
                    }
                    else
                    {
                        
server_cmd("amx_banip #%d 60 ^"[AC]FAST-FIRE Detected.^"",get_user_userid(i))
                    }
                }
            }
            
countBullets[i] = 0
        
}
    }



xPaw 02-18-2009 10:11

Re: Double command using problem[anti-fastfire+advanced_bans]
 
when checkBulletCount(); is called?

Metanabol 02-18-2009 15:13

Re: Double command using problem[anti-fastfire+advanced_bans]
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Anti FastFire"
#define VERSION "1.2"
#define AUTHOR "DarkSnow" //Respect ;)

#pragma tabsize 0
#define MAX_PLAYERS 32 

new countBullets[MAX_PLAYERS+1]
new 
g_amxban
new g_nCurWeapon[MAX_PLAYERS][2]
new 
g_MaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event"CurWeapon""Event_ShotFired",  "b" )
    
register_cvar("amx_af_max","17")
    
register_cvar("amx_af","1")
    
register_cvar("amx_af_amxban""1"//dissabled by default
    
register_cvar("amx_af_bantime""60")
    
set_task(1.0"checkBulletCount",127,_,_,"b")
}

public 
Event_ShotFiredid 

    new 
weaponID read_data
    new 
wAmmo read_data

    
g_MaxPlayers get_maxplayers()
    
    if( 
g_nCurWeapon[id-1][0] != weaponID // User Changed Weapons.. 
    

        
g_nCurWeapon[id-1][0] = weaponID 
        g_nCurWeapon
[id-1][1] = wAmmo 
        
return PLUGIN_CONTINUE 
    

    if( 
g_nCurWeapon[id-1][1] < wAmmo // User Reloaded.. 
    

        
g_nCurWeapon[id-1][1] = wAmmo 
        
return PLUGIN_CONTINUE 
    

    if( 
g_nCurWeapon[id-1][1] == wAmmo // User did something else, but didn't shoot.. 
        
return PLUGIN_CONTINUE 
    g_nCurWeapon
[id-1][1] = wAmmo 
    g_nCurWeapon
[id-1][0] = weaponID 

    countBullets
[id]++ //Counting the bullets, one by one, all day long :)

    
return PLUGIN_CONTINUE 
}  

public 
checkBulletCount()
{
    if (
get_cvar_num("amx_af") == 1)
    {
        for(new 
i=1;i<=g_MaxPlayers;i++)
        {
            if(
is_user_alive(i))
            {
                
//client_print(i,print_chat,"%i",countBullets[i])
                
if (countBullets[i] > get_cvar_num("amx_af_max"))
                {
                    new 
Authid[35],Name[32],CurrentTime[29],Map[32],ping,loss,Message[256]
                    
//client_print(0,print_chat,"%i",countBullets[i])
                    
get_user_name(i,Name,31)
                    
get_user_authid(i,Authid,34)
                    
get_mapname(Map,31)
                    
get_user_ping(i,ping,loss)
                    
get_time("%d/%m-%Y - %H:%M:%S",CurrentTime,29)
                    
                    
format(Message,255,"[Anti FastFire %s - %s] %s<%s> using FastFire type of cheat (Ping: %d )",CurrentTime,Map,Name,Authid,ping)
                    
log_amx(Message)

                    
client_print(0print_chat"%s booted by AF plugin.",Name)

                    if (
get_cvar_num("amx_af") == 1)
                    {
                        
server_cmd("amx_banip #%d 60 ^"[AC]FAST-FIRE Detected.^"",get_user_userid(i))
                    }
                    else
                    {
                        
server_cmd("amx_banip #%d 60 ^"[AC]FAST-FIRE Detected.^"",get_user_userid(i))
                    }
                }
            }
            
countBullets[i] = 0
        
}
    }


here is all code. please help me fix that ;)

Exolent[jNr] 02-19-2009 19:34

Re: Double command using problem[anti-fastfire+advanced_bans]
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Anti FastFire"
#define VERSION "1.2"
#define AUTHOR "DarkSnow" //Respect ;)

#pragma tabsize 0
#define MAX_PLAYERS 32 

new countBullets[MAX_PLAYERS+1]
new 
g_amxban
new g_nCurWeapon[MAX_PLAYERS][2]
new 
g_MaxPlayers
new bool:g_banned[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event"CurWeapon""Event_ShotFired",  "b" )
    
register_cvar("amx_af_max","17")
    
register_cvar("amx_af","1")
    
register_cvar("amx_af_amxban""1"//dissabled by default
    
register_cvar("amx_af_bantime""60")
    
set_task(1.0"checkBulletCount",127,_,_,"b")
}

public 
client_disconnect(client)
{
    
g_banned[client] = false;
}

public 
Event_ShotFiredid 

    if( 
g_banned[id] ) return PLUGIN_CONTINUE;
    
    new 
weaponID read_data
    new 
wAmmo read_data

    
g_MaxPlayers get_maxplayers()
    
    if( 
g_nCurWeapon[id-1][0] != weaponID // User Changed Weapons.. 
    

        
g_nCurWeapon[id-1][0] = weaponID 
        g_nCurWeapon
[id-1][1] = wAmmo 
        
return PLUGIN_CONTINUE 
    

    if( 
g_nCurWeapon[id-1][1] < wAmmo // User Reloaded.. 
    

        
g_nCurWeapon[id-1][1] = wAmmo 
        
return PLUGIN_CONTINUE 
    

    if( 
g_nCurWeapon[id-1][1] == wAmmo // User did something else, but didn't shoot.. 
        
return PLUGIN_CONTINUE 
    g_nCurWeapon
[id-1][1] = wAmmo 
    g_nCurWeapon
[id-1][0] = weaponID 

    countBullets
[id]++ //Counting the bullets, one by one, all day long :)

    
return PLUGIN_CONTINUE 
}  

public 
checkBulletCount()
{
    if (
get_cvar_num("amx_af") == 1)
    {
        for(new 
i=1;i<=g_MaxPlayers;i++)
        {
            if(!
g_banned[i] && is_user_alive(i))
            {
                
//client_print(i,print_chat,"%i",countBullets[i])
                
if (countBullets[i] > get_cvar_num("amx_af_max"))
                {
                    new 
Authid[35],Name[32],CurrentTime[29],Map[32],ping,loss,Message[256]
                    
//client_print(0,print_chat,"%i",countBullets[i])
                    
get_user_name(i,Name,31)
                    
get_user_authid(i,Authid,34)
                    
get_mapname(Map,31)
                    
get_user_ping(i,ping,loss)
                    
get_time("%d/%m-%Y - %H:%M:%S",CurrentTime,29)
                    
                    
format(Message,255,"[Anti FastFire %s - %s] %s<%s> using FastFire type of cheat (Ping: %d )",CurrentTime,Map,Name,Authid,ping)
                    
log_amx(Message)

                    
client_print(0print_chat"%s booted by AF plugin.",Name)

                    if (
get_cvar_num("amx_af") == 1)
                    {
                        
server_cmd("amx_banip #%d 60 ^"[AC]FAST-FIRE Detected.^"",get_user_userid(i))
                    }
                    else
                    {
                        
server_cmd("amx_banip #%d 60 ^"[AC]FAST-FIRE Detected.^"",get_user_userid(i))
                    }
                    
                    
g_banned[i] = true;
                }
            }
            
countBullets[i] = 0
        
}
    }



Metanabol 02-20-2009 14:17

Re: Double command using problem[anti-fastfire+advanced_bans]
 
Thank you very much. :up:


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

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