//==========================================================================================================================================\\ // \\ // Creative Commons Attribution-NonCommercial 4.0 International \\ // https://creativecommons.org/licenses/by-nc/4.0/ \\ // \\ // * You are free to: \\ // * Copy and redistribute the material in any medium or format. \\ // * Remix, transform, and build upon the material. \\ // \\ // * Under the following terms: \\ // * You must give appropriate credit, provide a link to the license, and indicate if changes were made. \\ // * You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. \\ // * You may not use the material for commercial purposes. \\ // * You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. \\ // \\ //==========================================================================================================================================\\ namespace BetterWeapons { namespace weapon_sniperrifle { ReflectionHook OnPlayerAttack( CBasePlayer@ pPlayer, CBasePlayerWeapon@ pWeapon, int AttackMode ) { if( pPlayer is null || pWeapon is null ) return ReflectionHook::NONE; json js = json( pJson[ "weapon_sniperrifle" ] ); switch( AttackMode ) { case ATTACK::PRIMARY: { if( pWeapon.m_iClip > 0 ) { if( (pPlayer.pev.flags & FL_FAKECLIENT) != 0 ) { pPlayer.m_rgAmmo( pWeapon.m_iPrimaryAmmoType, 5 ); } /*Vector vecSrc = pPlayer.GetGunPosition() + g_Engine.v_forward * 12; Vector vecAiming = pPlayer.GetAutoaimVector( AUTOAIM_2DEGREES ); if ( pPlayer.pev.fov < 50 ) { pWeapon.FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192.0, BULLET_PLAYER_CUSTOMDAMAGE, 1, 0, pPlayer.pev ); }*/ Vector punchangle = Vector( js[ "punchangle" ] ); pPlayer.pev.punchangle.x = 0; pPlayer.pev.punchangle.z = Math.RandomFloat( -punchangle.z, punchangle.z ); pPlayer.pev.punchangle.y = Math.RandomFloat( -punchangle.y, punchangle.y ); pWeapon.m_flNextPrimaryAttack = 1.4; } break; } } return ReflectionHook::NONE; } } }