下面是引用 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 的名子