Raised This Month: $2 Target: $400
 0% 

Sound Replace


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NooTy
Member
Join Date: Sep 2019
Old 06-15-2020 , 08:04   Sound Replace
Reply With Quote #1

Hey, I wanna help in this code
Code:
public fw_EmitSound(id, channel, String:sample[], Float:volume, Float:attn, flags, pitch)
{
    if (!is_user_connected(id))
    {
        return 1;
    }
	if (scmode[id] && equal(sample[8], "mp5",3))
    {
        if (equal(sample[14], "sho",3))
        volume = 0.60/*1058642330*/;
        {
        if (equal(sample, "weapons/mp5-1.wav"))
        {
	    emit_sound(id, CHAN_ITEM, "Brawl_Stars/effects/colt_attack.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        if (equal(sample, "weapons/mp5-2.wav"))
        {
            emit_sound(id, CHAN_ITEM, "Brawl_Stars/effects/colt_attack.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
}
        }

	if (skmode[id] && equal(sample[8], "kni",3))
    {
        volume = 0.60/*1058642330*/;
        if (equal(sample[14], "sla",3))
        {
            engfunc(EngFunc_EmitSound, id, channel, "Brawl_Stars/effects/mortis_attack.wav", volume, attn, flags, pitch);
            return 4;
        }
}
    return FMRES_IGNORED;
}
when i slap with knife work but mp5 not work
NooTy is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-15-2020 , 19:53   Re: Sound Replace
Reply With Quote #2

Post your whole code.
__________________
Private Work! || Discord:
Mr_Boopsy_#2066
supertrio17 is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 06-15-2020 , 21:29   Re: Sound Replace
Reply With Quote #3

https://forums.alliedmods.net/showthread.php?t=315863
__________________
+ARUKARI- is offline
allame61
Member
Join Date: Feb 2017
Location: Turkey
Old 06-19-2020 , 08:11   Re: Sound Replace
Reply With Quote #4

Works perfectly. This plugin changes firing sounds of weapons

Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#include <cstrike>
new silahsesler[][][] = {
	{CSW_AK47,"weapons/csgo17/ak47-1.wav",4},
	{CSW_AUG,"weapons/csgo17/aug-3.wav",4},
	{CSW_AWP,"weapons/csgo17/awp_12yn.wav",2},
	{CSW_SG552,"weapons/csgo17/sg552-2.wav",4},
	{CSW_FAMAS,"weapons/csgo17/famas-2.wav",4},
	{CSW_P90,"weapons/csgo17/p90-2.wav",4},
	{CSW_MP5NAVY,"weapons/csgo17/mp5-2.wav",4},
	{CSW_MAC10,"weapons/csgo17/mac10-1.wav",4},
	{CSW_M249,"weapons/csgo17/m249-1.wav",2},
	{CSW_GLOCK18,"weapons/csgo17/glock18-12yn.wav",5},
	{CSW_GALIL,"weapons/csgo17/galil-2.wav",4},
	{CSW_DEAGLE,"weapons/csgo17/deagle_012yn.wav",2},
	{CSW_SCOUT,"weapons/csgo17/scout-2.wav",2},
	{CSW_UMP45,"weapons/csgo17/ump45-2.wav",4},
	{CSW_M3,"weapons/csgo17/m3-2.wav",2},
	{CSW_P228,"weapons/csgo17/scout-2.wav",2},
	{CSW_XM1014,"weapons/csgo17/xm1014-2.wav",2}
}
new const susturuculuusp[] = "weapons/csgo17/susturuculu/usp-2.wav"
new const susturuculum4a1[] = "weapons/csgo17/susturuculu/m4a1-1.wav"
new const susturucusuzusp[] = "weapons/csgo17/susturucusuz/usp_unsil-1.wav"
new const susturucusuzm4a1[] = "weapons/csgo17/susturucusuz/m4a1_unsil-1.wav"
public plugin_precache(){
	for(new i;i<sizeof(silahsesler);i++){
		precache_sound(silahsesler[i][1])	
	}
	precache_sound(susturuculuusp)
	precache_sound(susturuculum4a1)
	precache_sound(susturucusuzusp)
	precache_sound(susturucusuzm4a1)
	
}
public plugin_init(){
	RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack")
	RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")
}


public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
	if(!is_user_alive(id) || !is_user_connected(id))
		return FMRES_IGNORED
	for(new i;i<sizeof(silahsesler);i++){
		if(get_user_weapon(id) == silahsesler[i][0][0])	
			set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
	}
	if(get_user_weapon(id) == CSW_USP)
		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
	if(get_user_weapon(id) == CSW_M4A1)
		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
	return FMRES_HANDLED
}
public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if (!is_user_connected(invoker))
		return FMRES_IGNORED
	static weapon; weapon = fm_find_ent_by_owner(-1, "weapon_m4a1", invoker)
	static weapon2; weapon2 = fm_find_ent_by_owner(-1, "weapon_usp", invoker)
	engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
	for(new i;i<sizeof(silahsesler);i++){
		if(get_user_weapon(invoker) == silahsesler[i][0][0]){	
			UTIL_PlayWeaponAnimation(invoker, silahsesler[i][2][0])
			emit_sound(invoker, CHAN_WEAPON, silahsesler[i][1], VOL_NORM, 0.2, 0, PITCH_HIGH)
		}
	}
	if(get_user_weapon(invoker) == CSW_M4A1){
		if(cs_get_weapon_silen(weapon)){
			UTIL_PlayWeaponAnimation(invoker, 2)
			emit_sound(invoker, CHAN_WEAPON, susturuculum4a1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)			
		}else{
			UTIL_PlayWeaponAnimation(invoker, 9)
			emit_sound(invoker, CHAN_WEAPON, susturucusuzm4a1, VOL_NORM, 0.2, 0, PITCH_HIGH)			
		}
	}
	if(get_user_weapon(invoker) == CSW_USP){
		if(cs_get_weapon_silen(weapon2)){
			UTIL_PlayWeaponAnimation(invoker, 2)
			emit_sound(invoker, CHAN_WEAPON, susturuculuusp, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)			
		}else{
			UTIL_PlayWeaponAnimation(invoker, 10)
			emit_sound(invoker, CHAN_WEAPON, susturucusuzusp, VOL_NORM, 0.2, 0, PITCH_HIGH)			
		}
	}
	return FMRES_SUPERCEDE
}
stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
{
	set_pev(Player, pev_weaponanim, Sequence)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
	write_byte(Sequence)
	write_byte(pev(Player, pev_body))
	message_end()
}

public fw_TraceAttack(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
	static Float:flEnd[3], Float:vecPlane[3]
	get_tr2(Ptr, TR_vecEndPos, flEnd)
	get_tr2(Ptr, TR_vecPlaneNormal, vecPlane)
	if(!is_user_alive(Victim))
	{
		Make_BulletHole(Attacker, flEnd, Damage)
	}
	return HAM_IGNORED
}
stock Make_BulletHole(id, Float:Origin[3], Float:Damage)
{
	static Decal; Decal = random_num(41, 45)
	static LoopTime;
	
	if(Damage > 100.0) LoopTime = 2
	else LoopTime = 1
	
	for(new i = 0; i < LoopTime; i++)
	{
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_WORLDDECAL)
		engfunc(EngFunc_WriteCoord, Origin[0])
		engfunc(EngFunc_WriteCoord, Origin[1])
		engfunc(EngFunc_WriteCoord, Origin[2])
		write_byte(Decal)
		message_end()
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_GUNSHOTDECAL)
		engfunc(EngFunc_WriteCoord, Origin[0])
		engfunc(EngFunc_WriteCoord, Origin[1])
		engfunc(EngFunc_WriteCoord, Origin[2])
		write_short(id)
		write_byte(Decal)
		message_end()
	}
}

Last edited by allame61; 06-19-2020 at 08:12. Reason: topic
allame61 is offline
Reply


Thread Tools
Display Modes

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 12:12.


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