PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define add_alive_property(%1) gBS_cl_alive |= (1<<(%1 - 1))
#define del_alive_property(%1) gBS_cl_alive &= ~(1<<(%1 - 1))
#define has_alive_property(%1) (gBS_cl_alive & (1<<(%1 - 1)))
const gC_CmdsLimit = 110
const gC_MaxIdle = 2500
const gC_MaxSlots = 32
new gBS_cl_alive
new gPV_logbans
new speed[gC_MaxSlots + 1]
new gCLI_count[gC_MaxSlots + 1]
new gCLI_buttons[gC_MaxSlots + 1]
new gCLI_idlecount[gC_MaxSlots + 1]
new Float:gCLF_lasttime[gC_MaxSlots + 1]
new Float:gCLV_views[gC_MaxSlots + 1][3]
new Float:gCLV_pviews[gC_MaxSlots + 1][3]
public plugin_init()
{
register_plugin("Block Speed Hack", "Testing version", "OT & Empower")
register_cvar("bsh_version", "testing", FCVAR_SERVER | FCVAR_SPONLY)
RegisterHam(Ham_Spawn, "player", "pfw_PlayerHandleAD", 1)
RegisterHam(Ham_Killed, "player", "pfw_PlayerHandleAD", 1)
register_forward(FM_CmdStart, "pfw_CmdStart",1)
}
public client_connect(id)
client_cmd(id,"developer 0")
public client_putinserver(id)
del_alive_property(id)
public client_disconnect(id)
{
speed[id] = 0
del_alive_property(id)
}
public pfw_CmdStart(id, pUC, seed)
{
if (!has_alive_property(id))
return FMRES_IGNORED
static old_packets[33]
old_packets[id] = gCLI_idlecount[id]
static Float:gametime, Float:gametime_old, Float:pack_a_sec
gametime_old = gametime
gametime = get_gametime()
pack_a_sec = 1.0/gametime-gametime_old
new Float:fGameTime, iButtons
new Float:vView[3]
pev(id, pev_v_angle, vView)
fGameTime = get_gametime()
get_uc(pUC, UC_Buttons, iButtons)
if (gCLI_count[id] > 0)
{
if (gCLI_buttons[id] == iButtons)
{
if (gCLV_pviews[id][0] == vView[0] && gCLV_pviews[id][1] == vView[1] && gCLV_pviews[id][2] == vView[2])
gCLI_idlecount[id]++
else
gCLI_idlecount[id] = 0
if (gCLI_idlecount[id] > gC_MaxIdle)
{
gCLV_views[id][0] == -8000.0
gCLI_idlecount[id] = 0
}
}
else
{
gCLI_idlecount[id] = 0
gCLI_buttons[id] = iButtons
}
gCLV_pviews[id][0] = vView[0]
gCLV_pviews[id][1] = vView[1]
gCLV_pviews[id][2] = vView[2]
}
if (gCLI_count[id] < 0)
{
gCLI_idlecount[id] = 0
gCLI_buttons[id] = iButtons
gCLV_pviews[id][0] = vView[0]
gCLV_pviews[id][1] = vView[1]
gCLV_pviews[id][2] = vView[2]
}
if (gCLV_views[id][0] == -8000.0 && gCLI_count[id] != -9)
{
gCLI_count[id] = -9
if(gCLI_idlecount[id]-old_packets[id]*pack_a_sec>110)
{
set_uc(pUC, UC_Buttons, 0)
static Float:c_speed
pev(id,pev_maxspeed,c_speed);
if(c_speed>1.0)
{
speed[id] = c_speed
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
set_pev(id, pev_maxspeed, 1.0) // prevent from moving
}
}
else if(speed[id])
{
set_pev(id, pev_maxspeed, speed[id])
speed[id] = 0;
}
return FMRES_IGNORED
}
if (gCLI_count[id] < -2)
{
gCLI_buttons[id] = iButtons
gCLV_views[id][0] = vView[0]
gCLV_views[id][1] = vView[1]
gCLV_views[id][2] = vView[2]
gCLI_count[id]++
if(gCLI_idlecount[id]-old_packets[id]*pack_a_sec>110)
{
set_uc(pUC, UC_Buttons, 0)
static Float:c_speed
pev(id,pev_maxspeed,c_speed);
if(c_speed>1.0)
{
speed[id] = c_speed
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
set_pev(id, pev_maxspeed, 1.0) // prevent from moving
}
}
else if(speed[id])
{
set_pev(id, pev_maxspeed, speed[id])
speed[id] = 0;
}
return FMRES_IGNORED
}
// If the user has begun targeting players
if (gCLV_views[id][0] == vView[0] && gCLV_views[id][1] == vView[1] && gCLV_views[id][2] == vView[2])
{
gCLI_count[id] = -2
if(gCLI_idlecount[id]-old_packets[id]*pack_a_sec>110)
{
set_uc(pUC, UC_Buttons, 0)
static Float:c_speed
pev(id,pev_maxspeed,c_speed);
if(c_speed>1.0)
{
speed[id] = c_speed
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
set_pev(id, pev_maxspeed, 1.0) // prevent from moving
}
}
else if(speed[id])
{
set_pev(id, pev_maxspeed, speed[id])
speed[id] = 0;
}
return FMRES_IGNORED
}
if (fGameTime - gCLF_lasttime[id] > 1.0)
{
//if (gCLI_count[id] > gC_MaxLimit)
// punish_player(id)
if (gCLI_count[id] < 0)
gCLI_count[id] ++
else
gCLI_count[id] = 0
gCLF_lasttime[id] = fGameTime
if(gCLI_idlecount[id]-old_packets[id]*pack_a_sec>110)
{
set_uc(pUC, UC_Buttons, 0)
static Float:c_speed
pev(id,pev_maxspeed,c_speed);
if(c_speed>1.0)
{
speed[id] = c_speed
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
set_pev(id, pev_maxspeed, 1.0) // prevent from moving
}
}
else if(speed[id])
{
set_pev(id, pev_maxspeed, speed[id])
speed[id] = 0;
}
return FMRES_IGNORED
}
if (gCLI_count[id] >= 0)
gCLI_count[id]++;
if(gCLI_idlecount[id]-old_packets[id]*pack_a_sec>110)
{
set_uc(pUC, UC_Buttons, 0)
static Float:c_speed
pev(id,pev_maxspeed,c_speed);
if(c_speed>1.0)
{
speed[id] = c_speed
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
set_pev(id, pev_maxspeed, 1.0) // prevent from moving
}
}
else if(speed[id])
{
set_pev(id, pev_maxspeed, speed[id])
speed[id] = 0;
}
return FMRES_IGNORED
}
public pfw_PlayerHandleAD(id)
{
if (is_user_alive(id))
{
gCLF_lasttime[id] = get_gametime()
gCLV_views[id][0] = -8000.0
gCLI_idlecount[id] = 0
add_alive_property(id)
}
else
del_alive_property(id)
return HAM_IGNORED
}