下面是引用 love2257210 於 2010-08-26 10:41 發表的 :
可以簡單的說明一下嗎?
我想我可以!
到這裡我也可以說一下..
之前寫莎拉有用到
設音效為SOUND_HURT,,音檔為xxxxxx
先new const SOUND_HURT[] = { "xxxxxx.wav" }
plugin_init()加上
register_forward(FM_EmitSound, "fw_EmitSound")
plugin_precache()加上
precache_sound(SOUND_HURT)
public fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
{
// Replace these next sounds for zombies only
if (!is_user_connected(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_speed) <---你喪屍類型
return FMRES_IGNORED;
if (sample[7] == 'b' && sample[8] == 'h' && sample[9] == 'i' && sample[10] == 't') //被擊中聲音
{
engfunc(EngFunc_EmitSound, id, CHAN_VOICE,
SOUND_HURT, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE;
}
if (sample[7] == 'd' && ((sample[8] == 'i' && sample[9] == 'e') || (sample[8] == 'e' && sample[9] == 'a'))) // 死亡聲音
{
engfunc(EngFunc_EmitSound, id, CHAN_VOICE,
SOUND_DIE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
上方紅色位置改為你在new const 的名子