其實和 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;
}