Raised This Month: $ Target: $400
 0% 

[SOLVED] Emit sound with Ham_TakeDamage?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-23-2017 , 18:03   [SOLVED] Emit sound with Ham_TakeDamage?
Reply With Quote #1

Hey :D

I'm trying to change the sound when we hit the zombie with my extra item, but is not sending anything. I'm using the following code:

Code:
RegisterHam(Ham_TakeDamage, "weapon_knife", "Ham_Player_TakeDamage");

public Ham_Player_TakeDamage(victim, inflictor, attacker, Float:damage)
{
	if (!is_user_alive(attacker) || get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED;
	
	emit_sound(id, CHAN_WEAPON, "weapons/hit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
	client_print(attacker, print_center, "DAMAGE!");
	
	return HAM_IGNORED;
}
Taking advantage of this topic, another problem is occurring with the Ham_Item_Deploy. I put it to emit a sound when the Player use the gun, but the sound is emitting more than once. The code is as follows:

Code:
RegisterHam(Ham_Item_Deploy, "weapon_knife", "Ham_ItemDeploy_Post", 1);

public Ham_ItemDeploy_Post(iEntity)
{
	if (!pev_valid(iEntity)) return HAM_IGNORED;
	
	new id = get_pdata_cbase(iEntity, 41, 4);
	
	if (!is_user_alive(id) || g_has_item[id]) return HAM_IGNORED;
	
	emit_sound(id, CHAN_WEAPON, "weapons/draw.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
	
	return HAM_IGNORED;
}
__________________









Last edited by CrazY.; 03-07-2017 at 08:53.
CrazY. is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode