Junior Member
|
01-10-2015
, 08:56
Re: Accuracy Fix
|
#120
|
Ah well, since my request has been ignored, I did it by myself, so if anyone is interested on how to turn off the plugin for just some people, you have entire code right here:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN_NAME "Accuracy Fix (with off option)"
#define PLUGIN_VERSION "3.0"
#define PLUGIN_AUTHOR "Numb"
#define SMOOTH_SPREAD_TRANSITION
#define LOW_FPS_SPREAD_COOLDOWN_FIX
#define m_pPlayer 41
#define m_flAccuracy 62
#define m_flLastFire 63
#define m_iShotsFired 64
#define m_fWeaponState 74
#define WEAPONSTATE_GLOCK18_BURST_MODE (1<<1)
#define m_flDecreaseShotsFired 76
new Float:g_fAccuracy;
#if defined LOW_FPS_SPREAD_COOLDOWN_FIX
new Float:g_fOldDecreaseShotsFired;
new g_iOldShotsFired;
#endif
new bool:g_bGlockDuckRemoved;
new bool:g_bGlockVelocityChanged;
new Float:g_fGlockVelocity[3];
new g_accbl[33], g_maxplayers
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_cvar("accuracy_fix", PLUGIN_VERSION, (FCVAR_SERVER|FCVAR_SPONLY));
#if defined LOW_FPS_SPREAD_COOLDOWN_FIX
RegisterHam(Ham_Item_PostFrame, "weapon_ak47", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_aug", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_famas", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_galil", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_m249", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_m4a1", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_mac10", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_mp5navy", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_p90", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_sg552", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_tmp", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_ump45", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_ak47", "Ham_PostFrame_Pre", 0);
RegisterHam(Ham_Item_PostFrame, "weapon_aug", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_famas", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_galil", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_m249", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_m4a1", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_mac10", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_mp5navy", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_p90", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_sg552", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_tmp", "Ham_PostFrame_Post", 1);
RegisterHam(Ham_Item_PostFrame, "weapon_ump45", "Ham_PostFrame_Post", 1);
#endif
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "Ham_Attack_ak47_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_aug", "Ham_Attack_aug_Pre", 0);
// awp accuracy offset does not exist
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "Ham_Attack_deagle_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "Ham_Attack_deagle_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_elite", "Ham_Attack_elite_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_elite", "Ham_Attack_elite_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_famas", "Ham_Attack_famas_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_fiveseven", "Ham_Attack_57_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_fiveseven", "Ham_Attack_57_Post", 1);
// g3sg1 accuracy offset has no effect
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "Ham_Attack_galil_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_glock18", "Ham_Attack_glock_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_glock18", "Ham_Attack_glock_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m249", "Ham_Attack_m249_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "Ham_Attack_m4a1_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mac10", "Ham_Attack_mac10_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "Ham_Attack_mp5_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p228", "Ham_Attack_p228_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p228", "Ham_Attack_p228_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p90", "Ham_Attack_p90_Pre", 0);
// scout accuracy offset does not exist
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "Ham_Attack_scout_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "Ham_Attack_scout_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg550", "Ham_Attack_sg550_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg552", "Ham_Attack_sg552_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_tmp", "Ham_Attack_tmp_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "Ham_Attack_ump45_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_usp", "Ham_Attack_usp_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_usp", "Ham_Attack_usp_Post", 1);
register_clcmd("amx_blockfix", "cmd_blockfix", 0, "<command><1 or 0> - command that allows player to turn the fix off for himself")
register_clcmd("amx_accfix_status", "cmd_accfix_status", ADMIN_BAN, "Displays all users who have blocked the plugin")
g_maxplayers = get_maxplayers()
}
public plugin_unpause()
{
g_fAccuracy = 0.0;
#if defined LOW_FPS_SPREAD_COOLDOWN_FIX
g_fOldDecreaseShotsFired = 0.0;
g_iOldShotsFired = 0;
#endif
g_bGlockDuckRemoved = false;
g_bGlockVelocityChanged = false;
}
#if defined LOW_FPS_SPREAD_COOLDOWN_FIX
public Ham_PostFrame_Pre(iEnt)
{
if(g_accbl[get_pdata_cbase(iEnt, m_pPlayer, 4)])
return
if( pev(get_pdata_cbase(iEnt, m_pPlayer, 4), pev_button)&IN_ATTACK )
{
g_fOldDecreaseShotsFired = 0.0;
g_iOldShotsFired = 0;
}
else
{
g_fOldDecreaseShotsFired = get_pdata_float(iEnt, m_flDecreaseShotsFired, 4);
if( g_fOldDecreaseShotsFired<get_gametime() )
g_iOldShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4);
else
{
g_fOldDecreaseShotsFired = 0.0;
g_iOldShotsFired = 0;
}
}
}
public Ham_PostFrame_Post(iEnt)
{
if(g_accbl[get_pdata_cbase(iEnt, m_pPlayer, 4)])
return
if( g_iOldShotsFired>0 && g_fOldDecreaseShotsFired>0.0 )
{
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4);
if( g_iOldShotsFired>s_iShotsFired>0 )
{
static Float:s_fDecreaseShotsFired;
s_fDecreaseShotsFired = get_pdata_float(iEnt, m_flDecreaseShotsFired, 4);
if( s_fDecreaseShotsFired>g_fOldDecreaseShotsFired )
{
static Float:s_fGameTime;
s_fGameTime = get_gametime();
if( s_fDecreaseShotsFired>s_fGameTime )
{
static Float:s_fDelay;
s_fDelay = (s_fDecreaseShotsFired-s_fGameTime);
s_fDecreaseShotsFired -= (s_fGameTime-g_fOldDecreaseShotsFired);
/*while( s_fDecreaseShotsFired<s_fGameTime ) // may not be super CPU friendly, if some other plugin messes things up
{
s_fDecreaseShotsFired += s_fDelay;
s_iShotsFired--;
if( s_iShotsFired<=0 )
break;
}
set_pdata_float(iEnt, m_flDecreaseShotsFired, s_fDecreaseShotsFired, 4);
set_pdata_int(iEnt, m_iShotsFired, s_iShotsFired, 4);*/
if( s_fDecreaseShotsFired<s_fGameTime ) // 'a bit' more complicated way, but does the same thing
{
static s_iDecreaseCount;
s_iDecreaseCount = floatround(((s_fGameTime-s_fDecreaseShotsFired)/s_fDelay), floatround_ceil);
if( s_iDecreaseCount>s_iShotsFired )
s_iDecreaseCount = s_iShotsFired;
set_pdata_float(iEnt, m_flDecreaseShotsFired, (s_fDecreaseShotsFired+(float(s_iDecreaseCount)*s_fDelay)), 4);
set_pdata_int(iEnt, m_iShotsFired, (s_iShotsFired-s_iDecreaseCount), 4);
}
else
set_pdata_float(iEnt, m_flDecreaseShotsFired, s_fDecreaseShotsFired, 4);
}
}
}
}
}
#endif
public Ham_Attack_ak47_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/200.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.15, 3));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/200.0)+0.35;
#endif
if( g_fAccuracy>1.25 )
g_fAccuracy = 1.25;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iFlags, s_iOwner
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_aug_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/215.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.1, 2));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/215.0)+0.3;
#endif
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_deagle_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
g_fAccuracy = 1.0;
else
g_fAccuracy = 0.96;
}
else
g_fAccuracy = 0.92;
}
else
g_fAccuracy = 0.92;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else if( get_pdata_int(iEnt, m_iShotsFired, 4)<=0 )
{
g_fAccuracy = get_pdata_float(iEnt, m_flAccuracy, 4);
g_fAccuracy -= (0.4-(get_gametime()-s_fLastFire))*0.35;
if( g_fAccuracy<0.55 )
g_fAccuracy = 0.55;
else if( g_fAccuracy>0.92 )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
{
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
}
else if( g_fAccuracy>0.96 )
g_fAccuracy = 0.96;
}
else
g_fAccuracy = 0.92;
}
else
g_fAccuracy = 0.92;
}
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
else
g_fAccuracy = -1.0;
}
public Ham_Attack_deagle_Post(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
if( g_fAccuracy>0.92 )
set_pdata_float(iEnt, m_flAccuracy , 0.92, 4);
else if( g_fAccuracy>0.0 )
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
public Ham_Attack_elite_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
g_fAccuracy = 1.0;
else
g_fAccuracy = 0.94;
}
else
g_fAccuracy = 0.88;
}
else
g_fAccuracy = 0.88;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else if( get_pdata_int(iEnt, m_iShotsFired, 4)<=0 )
{
g_fAccuracy = get_pdata_float(iEnt, m_flAccuracy, 4);
g_fAccuracy -= (0.325-(get_gametime()-s_fLastFire))*0.275;
if( g_fAccuracy<0.55 )
g_fAccuracy = 0.55;
else if( g_fAccuracy>0.88 )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
{
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
}
else if( g_fAccuracy>0.94 )
g_fAccuracy = 0.94;
}
else
g_fAccuracy = 0.88;
}
else
g_fAccuracy = 0.88;
}
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
else
g_fAccuracy = -1.0;
}
public Ham_Attack_elite_Post(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
if( g_fAccuracy>0.88 )
set_pdata_float(iEnt, m_flAccuracy , 0.88, 4);
else if( g_fAccuracy>0.0 )
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
public Ham_Attack_famas_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/215.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.1, 2));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/215.0)+0.3;
#endif
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_57_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
g_fAccuracy = 1.0;
else
g_fAccuracy = 0.96;
}
else
g_fAccuracy = 0.92;
}
else
g_fAccuracy = 0.92;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else if( get_pdata_int(iEnt, m_iShotsFired, 4)<=0 )
{
g_fAccuracy = get_pdata_float(iEnt, m_flAccuracy, 4);
g_fAccuracy -= (0.275-(get_gametime()-s_fLastFire))*0.25;
if( g_fAccuracy<0.725 )
g_fAccuracy = 0.725;
else if( g_fAccuracy>0.92 )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
{
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
}
else if( g_fAccuracy>0.96 )
g_fAccuracy = 0.96;
}
else
g_fAccuracy = 0.92;
}
else
g_fAccuracy = 0.92;
}
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
else
g_fAccuracy = -1.0;
}
public Ham_Attack_57_Post(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
if( g_fAccuracy>0.92 )
set_pdata_float(iEnt, m_flAccuracy , 0.92, 4);
else if( g_fAccuracy>0.0 )
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
public Ham_Attack_galil_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/200.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.15, 4));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/200.0)+0.35;
#endif
if( g_fAccuracy>1.25 )
g_fAccuracy = 1.25;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_glock_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static Float:s_fLastFire, bool:s_bInBurst;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( get_pdata_int(iEnt, m_fWeaponState, 4)&WEAPONSTATE_GLOCK18_BURST_MODE )
s_bInBurst = true;
else
s_bInBurst = false;
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
pev(s_iOwner, pev_velocity, g_fGlockVelocity);
if( !g_fGlockVelocity[0] && !g_fGlockVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
g_fAccuracy = 1.0;
else
g_fAccuracy = 0.95;
if( s_bInBurst )
{
if( ~s_iFlags&FL_DUCKING )
{
g_bGlockVelocityChanged = true;
set_pev(s_iOwner, pev_velocity, Float:{150.0, 0.0, 0.0});
}
}
}
else
{
g_fAccuracy = 0.90;
if( s_bInBurst )
{
g_bGlockVelocityChanged = true;
set_pev(s_iOwner, pev_velocity, Float:{0.0, 0.0, 0.0});
if( s_iFlags&FL_DUCKING )
{
g_bGlockDuckRemoved = true;
set_pev(s_iOwner, pev_flags, (s_iFlags&~FL_DUCKING));
}
}
}
}
else
g_fAccuracy = 0.90;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else if( get_pdata_int(iEnt, m_iShotsFired, 4)<=0 || s_bInBurst )
{
g_fAccuracy = get_pdata_float(iEnt, m_flAccuracy, 4);
g_fAccuracy -= (0.325-(get_gametime()-s_fLastFire))*0.275;
if( g_fAccuracy<0.6 )
g_fAccuracy = 0.6;
else if( g_fAccuracy>0.90 )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
pev(s_iOwner, pev_velocity, g_fGlockVelocity);
if( !g_fGlockVelocity[0] && !g_fGlockVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
{
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
}
else if( g_fAccuracy>0.95 )
g_fAccuracy = 0.95;
if( s_bInBurst )
{
if( ~s_iFlags&FL_DUCKING )
{
g_bGlockVelocityChanged = true;
set_pev(s_iOwner, pev_velocity, Float:{150.0, 0.0, 0.0});
}
}
}
else
{
g_fAccuracy = 0.90;
if( s_bInBurst )
{
g_bGlockVelocityChanged = true;
set_pev(s_iOwner, pev_velocity, Float:{0.0, 0.0, 0.0});
if( s_iFlags&FL_DUCKING )
{
g_bGlockDuckRemoved = true;
set_pev(s_iOwner, pev_flags, (s_iFlags&~FL_DUCKING));
}
}
}
}
else
g_fAccuracy = 0.90;
}
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
else
g_fAccuracy = -1.0;
}
public Ham_Attack_glock_Post(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
if( g_fAccuracy>0.90 )
set_pdata_float(iEnt, m_flAccuracy , 0.90, 4);
else if( g_fAccuracy>0.0 )
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
static s_iOwner;
s_iOwner = get_owner
if( g_bGlockVelocityChanged )
{
g_bGlockVelocityChanged = false;
set_pev(s_iOwner, pev_velocity, g_fGlockVelocity);
}
if( g_bGlockDuckRemoved )
{
g_bGlockDuckRemoved = false;
set_pev(s_iOwner, pev_flags, (pev(s_iOwner, pev_flags)|FL_DUCKING));
}
}
public Ham_Attack_m249_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/175.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.2, 4));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/175.0)+0.4;
#endif
if( g_fAccuracy>0.9 )
g_fAccuracy = 0.9;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_m4a1_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/220.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.15, 3));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/220.0)+0.35;
#endif
if( g_fAccuracy>1.25 )
g_fAccuracy = 1.25;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_mac10_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/200.0)+0.15+smooth_accuracy_transition((s_iShotsFired+1), 0.45, 8));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/200.0)+0.6;
#endif
if( g_fAccuracy>1.65 )
g_fAccuracy = 1.65;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.075, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.15, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.15, 4);
}
}
public Ham_Attack_mp5_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired)/220.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.25, 5));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired)/220.0)+0.45;
#endif
if( g_fAccuracy>0.75 )
g_fAccuracy = 0.75;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_p228_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
g_fAccuracy = 1.0;
else
g_fAccuracy = 0.95;
}
else
g_fAccuracy = 0.90;
}
else
g_fAccuracy = 0.90;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else if( get_pdata_int(iEnt, m_iShotsFired, 4)<=0 )
{
g_fAccuracy = get_pdata_float(iEnt, m_flAccuracy, 4);
g_fAccuracy -= (0.325-(get_gametime()-s_fLastFire))*0.3;
if( g_fAccuracy<0.6 )
g_fAccuracy = 0.6;
else if( g_fAccuracy>0.90 )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
{
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
}
else if( g_fAccuracy>0.95 )
g_fAccuracy = 0.95;
}
else
g_fAccuracy = 0.90;
}
else
g_fAccuracy = 0.90;
}
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
else
g_fAccuracy = -1.0;
}
public Ham_Attack_p228_Post(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
if( g_fAccuracy>0.90 )
set_pdata_float(iEnt, m_flAccuracy , 0.90, 4);
else if( g_fAccuracy>0.0 )
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
public Ham_Attack_p90_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired)/175.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.25, 6));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired)/175.0)+0.45;
#endif
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_scout_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_DUCKING || ~s_iFlags&FL_ONGROUND )
g_fAccuracy = 0.0;
else
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
set_pev(s_iOwner, pev_flags, (s_iFlags|FL_DUCKING));
g_fAccuracy = 1.0;
}
else
g_fAccuracy = 0.0;
}
}
public Ham_Attack_scout_Post(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
if( g_fAccuracy )
{
static s_iOwner;
s_iOwner = get_owner
set_pev(s_iOwner, pev_flags, (pev(s_iOwner, pev_flags)&~FL_DUCKING));
}
}
public Ham_Attack_sg550_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
g_fAccuracy = 1.0;
else
g_fAccuracy = 0.99;
}
else
g_fAccuracy = 0.98;
}
else
g_fAccuracy = 0.98;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
g_fAccuracy = (0.65+(get_gametime()-s_fLastFire))*0.725; //*0.35; (this is way too inaccurate comparing to g3sg1)
if( g_fAccuracy>0.98 )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
{
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
}
else if( g_fAccuracy>0.99 )
g_fAccuracy = 0.99;
}
else
g_fAccuracy = 0.98;
}
else
g_fAccuracy = 0.98;
}
else if( g_fAccuracy<0.5 )
g_fAccuracy = 0.5;
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
}
public Ham_Attack_sg552_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/220.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.1, 3));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/220.0)+0.3;
#endif
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_tmp_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired*s_iShotsFired)/220.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.35, 7));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired*s_iShotsFired)/220.0)+0.55;
#endif
if( g_fAccuracy>1.4 )
g_fAccuracy = 1.4;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_ump45_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static s_iShotsFired;
s_iShotsFired = get_pdata_int(iEnt, m_iShotsFired, 4)-1;
if( s_iShotsFired>=0 )
{
#if defined SMOOTH_SPREAD_TRANSITION
g_fAccuracy = (((s_iShotsFired*s_iShotsFired)/210.0)+0.2+smooth_accuracy_transition((s_iShotsFired+1), 0.3, 5));
#else
g_fAccuracy = ((s_iShotsFired*s_iShotsFired)/210.0)+0.5;
#endif
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
set_pdata_float(iEnt, m_flAccuracy, 0.0, 4);
else
set_pdata_float(iEnt, m_flAccuracy, 0.1, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
else
set_pdata_float(iEnt, m_flAccuracy, 0.2, 4);
}
}
public Ham_Attack_usp_Pre(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
static Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
g_fAccuracy = 1.0;
else
g_fAccuracy = 0.96;
}
else
g_fAccuracy = 0.92;
}
else
g_fAccuracy = 0.92;
set_pdata_float(iEnt, m_flAccuracy, g_fAccuracy, 4);
}
else if( get_pdata_int(iEnt, m_iShotsFired, 4)<=0 )
{
g_fAccuracy = get_pdata_float(iEnt, m_flAccuracy, 4);
g_fAccuracy -= (0.3-(get_gametime()-s_fLastFire))*0.275;
if( g_fAccuracy<0.6 )
g_fAccuracy = 0.6;
else if( g_fAccuracy>0.92 )
{
static s_iOwner, s_iFlags;
s_iOwner = get_owner
s_iFlags = pev(s_iOwner, pev_flags);
if( s_iFlags&FL_ONGROUND )
{
static Float:s_fVelocity[3];
pev(s_iOwner, pev_velocity, s_fVelocity);
if( !s_fVelocity[0] && !s_fVelocity[1] )
{
if( s_iFlags&FL_DUCKING )
{
if( g_fAccuracy>1.0 )
g_fAccuracy = 1.0;
}
else if( g_fAccuracy>0.96 )
g_fAccuracy = 0.96;
}
else
g_fAccuracy = 0.92;
}
else
g_fAccuracy = 0.92;
}
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
else
g_fAccuracy = -1.0;
}
public Ham_Attack_usp_Post(iEnt)
{
static get_owner
get_owner = get_pdata_cbase(iEnt, m_pPlayer, 4)
if(g_accbl[get_owner])
return
if( g_fAccuracy>0.92 )
set_pdata_float(iEnt, m_flAccuracy , 0.92, 4);
else if( g_fAccuracy>0.0 )
set_pdata_float(iEnt, m_flAccuracy , g_fAccuracy, 4);
}
#if defined SMOOTH_SPREAD_TRANSITION
Float:smooth_accuracy_transition(iSteppingId, Float:fMaxInaccuracy, iSteppingsMax)
{
if( iSteppingId>=iSteppingsMax )
return fMaxInaccuracy;
return ((float(iSteppingId)*fMaxInaccuracy)/float(iSteppingsMax));
}
#endif
public cmd_blockfix(id)
{
new cmd_value[2]
read_argv(1,cmd_value,1)
if(cmd_value[0] == '1') // turn off the plugin
{
g_accbl[id] = 1
console_print(id,"Your accuracy_fix was successfully turned off!")
}
else // turn on plugin
{
g_accbl[id] = 0
console_print(id,"Your accuracy_fix was successfully turned on!")
}
}
public cmd_accfix_status(id)
{
if(!(get_user_flags(id) & ADMIN_BAN))
{
console_print(id,"You have no permission to use that command!")
return PLUGIN_HANDLED
}
new w_num, w_anounce[180], w_block_count, w_pl_name[16]
formatex(w_anounce,179,"[AMXX] Players who have blocked fix are:")
for(w_num = 1; w_num < g_maxplayers; w_num++)
{
if(g_accbl[w_num] == 1 && is_user_connected(w_num))
{
w_block_count++
get_user_name(w_num,w_pl_name,15)
format(w_anounce, 179, "%s | #%d#%s", w_anounce, w_num, w_pl_name)
if(w_block_count != 0 && w_block_count % 5 == 0)
{
console_print(id,w_anounce)
formatex(w_anounce,179,"[AMXX] :")
}
}
}
if(w_block_count == 0 || w_block_count % 5 != 0)
{
console_print(id,w_anounce)
}
return PLUGIN_HANDLED
}
public client_putinserver(id)
{
new accval[2]
get_user_info(id, "_accblock", accval, 1)
if(accval[0] == '1') // if it is auto turned off
g_accbl[id] = 1
else // for everyone else
g_accbl[id] = 0
}
So, what this does is skipping forwards for those who want them skipped, as well as a way for person to save possibility to turn it off every time it connects to the server.
There is also a command where people with "d" flag can see who has plugin turned off.
|
|