其实和 CSO-NST 原理差不多 ^^"
以 英雄战击 的写法作例子
复制程式
new const SVD_weapons[] = { "weapons/svdex-1.wav" } //英雄战击开火的声音
public plugin_precache(){
precache_sound(SVD_weapons)
}
public plugin_init(){
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "fw_WeapPriAttack")
}
public fw_WeapPriAttack(weapon){
if (!pev_valid(weapon))
return HAM_IGNORED;
if (fm_get_weaponid(weapon) != CSW_M4A1)
return HAM_IGNORED;
static owner
owner = pev(weapon, pev_owner)
if (fm_get_weapon_ammo(weapon) > 0){
emit_sound(owner, CHAN_AUTO, SVD_weapons, 1.0, ATTN_NONE, 0, 150)
}
return HAM_IGNORED;
}