PHP Code:
/* Formatright © 2010, ConnorMcLeod
Silenced Usp is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Silenced Usp; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new const VERSION[] = "0.0.1"
#define EXTRAOFFSET_WEAPONS 4
#define m_pPlayer 41
#define m_flNextSecondaryAttack 47
#define OFFSET_SILENCER_FIREMODE 74
const USP_SILENCED = (1<<0)
#define set_usp_silent(%1) set_pdata_int(%1, OFFSET_SILENCER_FIREMODE, USP_SILENCED, EXTRAOFFSET_WEAPONS)
#define get_weapon_owner(%1) get_pdata_cbase(%1, m_pPlayer, EXTRAOFFSET_WEAPONS)
public plugin_init()
{
register_plugin("Silenced Usp", VERSION, "ConnorMcLeod")
RegisterHam(Ham_Item_Deploy, "weapon_usp", "Usp_Deploy", 1)
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_usp", "Usp_SecondaryAttack", 1)
}
public Usp_Deploy(iEnt)
{
set_usp_silent(iEnt)
SendWeaponAnim( get_weapon_owner(iEnt) , 6)
}
public Usp_SecondaryAttack(iEnt)
{
set_usp_silent(iEnt)
SendWeaponAnim( get_weapon_owner(iEnt) , 0)
set_pdata_float(iEnt, m_flNextSecondaryAttack, 9999.9, EXTRAOFFSET_WEAPONS)
}
SendWeaponAnim(id, iAnim)
{
entity_set_int(id, EV_INT_weaponanim, iAnim)
message_begin(MSG_ONE, SVC_WEAPONANIM, _, id)
write_byte(iAnim)
write_byte(entity_get_int(id, EV_INT_body))
message_end()
}
__________________