#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
new last_stand[33],Float:duck_start_time[33],Float:last_origin[33][3]
public plugin_init() {
register_plugin("Anti DD Scroll", "1.0", "Empower")
register_forward(FM_CmdStart, "pfw_CmdStart", 1)
register_cvar("adds_version", "1.0", FCVAR_SERVER | FCVAR_SPONLY)
register_event("HLTV", "NewRound", "a", "1=0", "2=0")
}
public Respawn()
{
new Players[32]
new Count, i, player
get_players(Players, Count, "ach")
for (i=0; i<Count; i++)
{
player = Players[i]
if(!cs_get_user_buyzone(player))
{
ExecuteHamB(Ham_CS_RoundRespawn,player)
}
}
}
public NewRound()
{
set_task(0.58, "Respawn")
}
public pfw_CmdStart(id, pUC, seed)
{
new iButtons = get_uc(pUC, UC_Buttons)
// just ducked
if(iButtons & IN_DUCK)
{
if(last_stand[id])
{
pev(id,pev_origin,last_origin[id])
duck_start_time[id] = get_gametime()
last_stand[id] = false;
}
}
// just got up
else
{
if(!last_stand[id])
{
new Float:fGameTime = get_gametime()
// So low time, this is scroll for sure, block duck.
if((fGameTime-duck_start_time[id])<0.018)
{
engfunc(EngFunc_SetOrigin, id, last_origin[id])
set_pev(id, pev_bInDuck, false);
}
}
last_stand[id] = true;
}
}