#include <amxmodx>
#include <engine>
#include <fakemeta>
new Float:g_lastcheck[33], Float:g_lastcheck2[33]
new Float:g_cur_origin[33][3]
new Float:g_vic_origin[33][3]
new antihack_active
new cvar_antispeed, cvar_antispeed_code, cvar_ban_minutes
public plugin_init()
{
register_plugin("AntiHack Speed", "1.0", "Dias")
register_event("HLTV", "event_newround", "a", "1=0", "2=0")
register_logevent("event_round_end", 2, "1=Round_End")
register_event("TextMsg","event_round_end","a","2=#Game_Commencing","2=#Game_will_restart_in")
cvar_antispeed = register_cvar("sv_antihack_speed", "1")
cvar_antispeed_code = register_cvar("sv_antihack_speed_code", "370.0")
cvar_ban_minutes = register_cvar("sv_antihack_ban_minutes", "0")
}
public plugin_cfg()
{
set_task(1.0, "event_newround")
}
public event_newround(id)
{
set_task(1.0, "active_antihack", id)
}
public event_round_end(id)
{
antihack_active = 0
}
public active_antihack(id)
{
antihack_active = 1
g_vic_origin[id] = g_cur_origin[id]
}
public client_PostThink(id)
{
if(is_user_alive(id) && antihack_active && get_pcvar_num(cvar_antispeed))
{
static Float:Current_Time
Current_Time = get_gametime()
if(Current_Time - 0.5 > g_lastcheck[id])
{
pev(id, pev_origin, g_cur_origin[id])
g_lastcheck[id] = Current_Time
}
if(Current_Time - 1.0 > g_lastcheck2[id])
{
check_origin(id)
g_lastcheck2[id] = Current_Time
}
}
}
public check_origin(id)
{
static Float:distance
pev(id, pev_origin, g_vic_origin[id])
distance = get_distance_f(g_cur_origin[id], g_vic_origin[id])
if(distance > get_pcvar_float(cvar_antispeed_code) && pev(id, pev_flags) & FL_ONGROUND)
{
static name[32]
get_user_name(id, name, sizeof(name))
server_cmd("amx_banip %s %s Hack_Speed_Detect", get_pcvar_num(cvar_ban_minutes), name)
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
*/