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(PLUGIN, VERSION, AUTHOR)
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_ShotFired( id )
{
if( g_banned[id] ) return PLUGIN_CONTINUE;
new weaponID = read_data( 2 )
new wAmmo = read_data( 3 )
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(0, print_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
}
}
}