Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

История благодарностей участнику Naiteki ::: Спасибо сказали: 10
Дата поста: В теме: За сообщение: Спасибо сказали:
5.3.2015, 13:34 FrozenTag Mod v 2.95 Beta
Я сделал скрины:
Скрытый текст





Bloo
28.2.2015, 18:38 STEAM CFG (Настройки)
developer "0"
rate "100000"
cam_snapto "1"
fps_max "101"
cl_updaterate "101"
cl_cmdrate "105"
hud_fastswitch "1"
gl_round_down "10"
gl_cull "1"
gl_dither "0"
cl_dynamiccrosshair "0"
cl_crosshair_size "1"
cl_bob "0"
cl_bobcycle "0"
cl_bobup "0"
ex_interp "0.01"
cl_idealpitchscale "0.1"
cl_fixtimerate "3.3"
cl_dlmax "9999"
gl_vsync "0"
cl_lw "0"
cl_lc "0"
nastia777
25.2.2015, 8:41 Настройка стрельбы
Цитата(lpulbka @ 25.2.2015, 7:14) *
Все всем спасибо, я полностью разобрался)

Можно узнать как?

Может эти плагины улучшают стрельбу?

GoodShot
Код:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define m_flLastFireTime_Win32 79
#define m_flLastFireTime_LinuxDiff 4

public plugin_init() {
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_aug", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Item_Deploy, "weapon_awp", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_WeaponIdle, "weapon_c4", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_c4", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_elite", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_fiveseven", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_WeaponIdle, "weapon_flashbang", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_flashbang", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_g3sg1", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_glock18", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_WeaponIdle, "weapon_hegrenade", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_hegrenade", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m249", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m3", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_Reload, "weapon_m3", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_m4a1", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mac10", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p228", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p90", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Item_Deploy, "weapon_scout", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg550", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg552", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_WeaponIdle, "weapon_smokegrenade", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_smokegrenade", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_tmp", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_usp", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_usp", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_famas", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_xm1014", "BeforeGetNextAttackDelay", false);
RegisterHam(Ham_Weapon_Reload, "weapon_xm1014", "BeforeGetNextAttackDelay", false);
}

public BeforeGetNextAttackDelay(const iEntity) {
set_pdata_float(iEntity, m_flLastFireTime_Win32, 0.0, m_flLastFireTime_LinuxDiff);
}


RecoilFix
Код:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN_NAME "Recoil Fix"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Numb"

#define SetPlayerBit(%1,%2) ( %1 |= ( 1 << ( %2 & 31 ) ) )
#define ClearPlayerBit(%1,%2) ( %1 &= ~( 1 << ( %2 & 31 ) ) )
#define CheckPlayerBit(%1,%2) ( %1 & ( 1 << ( %2 & 31 ) ) )

#define m_pPlayer 41

new g_iCvar_RecoilFix;
new g_iAlive;

//#define DEBUG
//#define DEBUG_ANGLE

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

register_forward(FM_PlayerPostThink, "FM_PlayerPostThink_Pre", 0);
register_forward(FM_UpdateClientData, "FM_UpdateClientData_Post", 1);

RegisterHam(Ham_Spawn, "player", "Ham_Spawn_player_Post", 1);
RegisterHam(Ham_Killed, "player", "Ham_Killed_player_Post", 1);

g_iCvar_RecoilFix = register_cvar("recoil_fix", "1"); // 1 fix for dead, 2 fix for alive, 3 real fix
}

public plugin_unpause()
{
g_iAlive = 0;

new iPlayers[32], iPlayerNum;
get_players(iPlayers, iPlayerNum, "a");
for( new iLoop; iLoop<iPlayerNum; iLoop++ )
SetPlayerBit(g_iAlive, iPlayers[iLoop]);
}

public client_disconnect(iPlrId)
ClearPlayerBit(g_iAlive, iPlrId);

public FM_PlayerPostThink_Pre(iPlrId)
{
if( CheckPlayerBit(g_iAlive, iPlrId) && get_pcvar_num(g_iCvar_RecoilFix)>=3 )
{
static Float:s_fAngle[3], Float:s_fPunchAngle[3];
pev(iPlrId, pev_v_angle, s_fAngle);
pev(iPlrId, pev_punchangle, s_fPunchAngle);
s_fAngle[0] -= (s_fPunchAngle[0]-180.0);
s_fAngle[1] -= (s_fPunchAngle[1]-180.0);
s_fAngle[2] += 180.0;

if( s_fAngle[0]<=0.0 || s_fAngle[0]>360.0 )
s_fAngle[0] -= (float(floatround((s_fAngle[0]/360.0)))*360.0);
if( s_fAngle[1]<=0.0 || s_fAngle[1]>360.0 )
s_fAngle[1] -= (float(floatround((s_fAngle[1]/360.0)))*360.0);
if( s_fAngle[2]<=0.0 || s_fAngle[2]>360.0 )
s_fAngle[2] -= (float(floatround((s_fAngle[2]/360.0)))*360.0);

s_fAngle[0] -= 180.0;
s_fAngle[1] -= 180.0;
s_fAngle[2] -= 180.0;

set_pev(iPlrId, pev_v_angle, s_fAngle);
}

#if defined DEBUG_ANGLE
static Float:s_fPlrAngle[3];
pev(iPlrId, pev_v_angle, s_fPlrAngle);
client_print(iPlrId, print_center, "Angle %f %f", s_fPlrAngle[0], s_fPlrAngle[1]);
#endif
}

public FM_UpdateClientData_Post(iPlrId, iSendWeapons, iCdHandle)
{
switch( clamp(get_pcvar_num(g_iCvar_RecoilFix), 0, 3) )
{
case 1: // make dead see it from alive point of view (where bullets should go, without spread caclulation)
{
if( !CheckPlayerBit(g_iAlive, iPlrId) )
{
static Float:s_fPunchAngle[3];
get_cd(iCdHandle, CD_PunchAngle, s_fPunchAngle);
s_fPunchAngle[0] *= 0.0;
s_fPunchAngle[1] *= 0.0;
s_fPunchAngle[2] *= 0.0;
set_cd(iCdHandle, CD_PunchAngle, s_fPunchAngle);
}
}
case 2: // make alive see it from dead point of view (where bullets do go, without spread caclulation)
{
if( !CheckPlayerBit(g_iAlive, iPlrId) )
{
static Float:s_fPunchAngle[3];
get_cd(iCdHandle, CD_PunchAngle, s_fPunchAngle);
s_fPunchAngle[0] *= 2.0;
s_fPunchAngle[1] *= 2.0;
s_fPunchAngle[2] *= 2.0;
set_cd(iCdHandle, CD_PunchAngle, s_fPunchAngle);
}
}
case 3: // make dead see it from alive point of view (where bullets do go, without spread caclulation)
{
if( !CheckPlayerBit(g_iAlive, iPlrId) )
{
static Float:s_fPunchAngle[3];
get_cd(iCdHandle, CD_PunchAngle, s_fPunchAngle);
s_fPunchAngle[0] *= 0.0;
s_fPunchAngle[1] *= 0.0;
s_fPunchAngle[2] *= 0.0;
set_cd(iCdHandle, CD_PunchAngle, s_fPunchAngle);
}
}
}
}

public Ham_Spawn_player_Post(iPlrId)
{
if( is_user_alive(iPlrId) )
SetPlayerBit(g_iAlive, iPlrId);
else
ClearPlayerBit(g_iAlive, iPlrId);
}

public Ham_Killed_player_Post(iPlrId)
{
if( is_user_alive(iPlrId) )
SetPlayerBit(g_iAlive, iPlrId);
else
ClearPlayerBit(g_iAlive, iPlrId);
}


#if defined DEBUG

new g_iSpriteId;
new g_iFwdFM_TraceLine_Post;

public plugin_precache()
g_iSpriteId = precache_model("sprites/3dmflared.spr");

public plugin_cfg()
{
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_glock18", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_glock18", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_usp", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_usp", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p228", "Ham_Attack_Pre", 0)
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p228", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_elite", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_elite", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_fiveseven", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_fiveseven", "Ham_Attack_Post", 1);

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m3", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m3", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_xm1014", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_xm1014", "Ham_Attack_Post", 1);

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mac10", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mac10", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_tmp", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_tmp", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p90", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_p90", "Ham_Attack_Post", 1);

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_famas", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_famas", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg552", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg552", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_aug", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_aug", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_g3sg1", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_g3sg1", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg550", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_sg550", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "Ham_Attack_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "Ham_Attack_Post", 1);

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m249", "Ham_Attack_Pre", 0);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m249", "Ham_Attack_Post", 1);
}

public Ham_Attack_Pre(iEnt)
{
if( g_iFwdFM_TraceLine_Post )
{
unregister_forward(FM_TraceLine, g_iFwdFM_TraceLine_Post, 1)
g_iFwdFM_TraceLine_Post = 0;
}
g_iFwdFM_TraceLine_Post = register_forward(FM_TraceLine, "FM_TraceLine_Post", 1);
}

public Ham_Attack_Post(iEnt)
{
if( g_iFwdFM_TraceLine_Post )
{
unregister_forward(FM_TraceLine, g_iFwdFM_TraceLine_Post, 1)
g_iFwdFM_TraceLine_Post = 0;
}
}

public FM_TraceLine_Post(Float:fStart[3], Float:fEnd[3], iNoMonsters, iEntToSkip, iTraceResult)
{
static Float:s_fTraceEnd[3];
get_tr(TR_vecEndPos, s_fTraceEnd);

message_begin(MSG_ALL, SVC_TEMPENTITY)
write_byte(TE_SPRITE);
engfunc(EngFunc_WriteCoord, s_fTraceEnd[0]);
engfunc(EngFunc_WriteCoord, s_fTraceEnd[1]);
engfunc(EngFunc_WriteCoord, s_fTraceEnd[2]);
write_short(g_iSpriteId);
write_byte(1);
write_byte(255);
message_end();
}
#endif


AccuracyFix
Код:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN_NAME "Accuracy Fix"
#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];


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);
}

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( 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_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 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_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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_pdata_cbase(iEnt, m_pPlayer, 4);
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)
{
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 Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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_pdata_cbase(iEnt, m_pPlayer, 4);
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)
{
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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_pdata_cbase(iEnt, m_pPlayer, 4);
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)
{
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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_pdata_cbase(iEnt, m_pPlayer, 4);
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)
{
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_pdata_cbase(iEnt, m_pPlayer, 4);

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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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_pdata_cbase(iEnt, m_pPlayer, 4);
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)
{
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 s_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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)
{
if( g_fAccuracy )
{
static s_iOwner;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
set_pev(s_iOwner, pev_flags, (pev(s_iOwner, pev_flags)&~FL_DUCKING));
}
}


public Ham_Attack_sg550_Pre(iEnt)
{
static Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 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_pdata_cbase(iEnt, m_pPlayer, 4);
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 Float:s_fLastFire;
s_fLastFire = get_pdata_float(iEnt, m_flLastFire, 4);
if( !s_fLastFire )
{
static s_iOwner, s_iFlags;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
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_pdata_cbase(iEnt, m_pPlayer, 4);
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)
{
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
tenb63rus
27.1.2015, 16:25 ADMIN / V.I.P Models


Выкладываю свою версию Admin/Vip models.
В этом плагине используется "Player Models" инклуд, который намного надёжнее чем "cs_set_user_model()".

Описание:
Плагин, при помощи которого Admin/Vip получает уникальный скин с надписью "Admin".


Скачать
bondarenko78bk, c0o_PeR
25.11.2014, 15:20 Что Лучше AMX 1.8.1, 1.8.2 или 1.8.3
У меня на новейшем билде стоит AMX 1.8.3 и все плагины нормально работают. Меньше багов + больше стабильности, так зачем использовать что то старое?
klauskos
23.11.2014, 18:40 Куплю AIM/OpenGL32 Detector by mazdan
mertka4 уже помог мне, большое спасибо ему за помощь!! good.gif
mertka4
18.11.2014, 19:38 Снег
Плагин: https://forums.alliedmods.net/showthread.ph...8960#post358960

или

Код
#include < amxmodx >
#include < engine >

public plugin_precache( ) {
    register_plugin( "Snow", "1.0", "xPaw" );
    
    create_entity( "env_snow" );
}


или

Код
#include <amxmodx>
#include <fakemeta>

new const VERSION[] = "0.1";

public plugin_init()
    register_plugin("Snow", VERSION, "floatman");

public plugin_precache()
    engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"));
damilurg, l3x1s, Safety1st