C++:
if(WEAPON_ANIM_STAB)
{
emit_sound(iPlayer, CHAN_ITEM, hammer_fire_sounds[5], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
else if(WEAPON_ANIM_STAB_MISS)
{
emit_sound(iPlayer, CHAN_ITEM, hammer_fire_sounds[4], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
C++:
const WEAPON_ANIM_STAB = 4
const WEAPON_ANIM_STAB_MISS = 5
const Float: WEAPON_ANIM_STAB_TIME = 0.826
const Float: WEAPON_ANIM_STAB_MISS_TIME = 0.755
Как сделать проверку на то, что игрок нажимает ПКМ по воздуху, воспроизводится звук удара по воздуху?
20 Апр 2023
20 Апр 2023
C++:
public fw_WeaponSecondaryAttack(knife)
{
static iPlayer
iPlayer = get_pdata_cbase(knife, m_pPlayer, 4)
if(zp_get_user_zombie(iPlayer) || !g_has_hammer_fire[iPlayer])
return HAM_IGNORED
UTIL_SendWeaponAnim(MSG_ONE, iPlayer, WEAPON_ANIM_STAB)
UTIL_SendWeaponAnim(MSG_ONE, iPlayer, WEAPON_ANIM_STAB_MISS)
set_pdata_float(iPlayer, m_flNextAttack, 0.5)
set_pdata_int(knife, m_iWeaponState, true, 4)
return HAM_SUPERCEDE
}
public fw_ItemPostFrame(knife)
{
static iPlayer
iPlayer = get_pdata_cbase(knife, m_pPlayer, 4)
static Float:flTime
flTime = WEAPON_ANIM_STAB_TIME
if(zp_get_user_zombie(iPlayer) || !g_has_hammer_fire[iPlayer])
return HAM_IGNORED
if(!get_pdata_int(knife, m_iWeaponState, 4))
return HAM_IGNORED
if(is_user_connected(iPlayer))
{
new FmHook_EmitSound_Pre = register_forward(FM_EmitSound, "CEntity__EmitSound", false);
EnableHamForward(g_HamHook_SendWeaponAnim_Pre)
ExecuteHam(Ham_Weapon_SecondaryAttack, knife)
DisableHamForward(g_HamHook_SendWeaponAnim_Pre)
unregister_forward(FM_EmitSound, FmHook_EmitSound_Pre, false)
if(WEAPON_ANIM_STAB)
emit_sound(iPlayer, CHAN_ITEM, hammer_fire_sounds[5], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
else if(WEAPON_ANIM_STAB_MISS)
emit_sound(iPlayer, CHAN_ITEM, hammer_fire_sounds[4], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
set_pdata_int(knife, m_iWeaponState, false, 4)
set_pdata_float(iPlayer, m_flNextSecondaryAttack, 1.0)
set_pdata_float(knife, m_flTimeWeaponIdle, flTime, 4)
}
return HAM_IGNORED
}
20 Апр 2023
FmHook_EmitSound_Pre
до unregister_forward(FM_EmitSound, FmHook_EmitSound_Pre, false)
отстой полный, можно его как-то оптимизировать что-ли?20 Апр 2023
Последнее редактирование: