AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Trying to change 2 emit sound (https://forums.alliedmods.net/showthread.php?t=222702)

ironskillz1 08-05-2013 14:35

Trying to change 2 emit sound
 
None of them want to change sound
Code:

register_forward(FM_EmitSound, "EmitSound")
Code:

public fw_emitsound(id, ent,channel,sample[],Float:volume,Float:atten,flags,pitch) {
 if( g_iCurrentDay == DAY_DODGEBALL )
 {
  if(containi(sample,"he_bounce") != -1) {
  if(entity_get_float(ent,EV_FL_fuser1) + 0.3 < get_gametime()) {
    entity_set_float(ent,EV_FL_fuser1,get_gametime());
    emit_sound(ent,CHAN_ITEM,"weapons/g_bounce1.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);
  }
  return FMRES_SUPERCEDE;
  }
 }
 
 if(!is_user_alive(id) || !is_user_connected(id))
  return FMRES_IGNORED
 
 new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
 if( g_iCurrentDay == DAY_BOXING )
 {
  if(weapon == CSW_KNIFE)
  {
  if(equal(sample,"weapons/knife_hit1.wav"))
  {
    emit_sound(id, CHAN_WEAPON, g_szBoxingSound1, 1.0, ATTN_NORM, 0, PITCH_NORM)
    return FMRES_SUPERCEDE
  }
  else if(equal(sample,"weapons/knife_hit2.wav"))
  {
    emit_sound(id, CHAN_WEAPON, g_szBoxingSound2, 1.0, ATTN_NORM, 0, PITCH_NORM)
    return FMRES_SUPERCEDE
  }
  else if(equal(sample,"weapons/knife_hit3.wav"))
  {
    emit_sound(id, CHAN_WEAPON, g_szBoxingSound3, 1.0, ATTN_NORM, 0, PITCH_NORM)
    return FMRES_SUPERCEDE
  }
  else if(equal(sample,"weapons/knife_hit4.wav"))
  {
    emit_sound(id, CHAN_WEAPON, g_szBoxingSound4, 1.0, ATTN_NORM, 0, PITCH_NORM)
    return FMRES_SUPERCEDE
  }
  else if(equal(sample,"weapons/knife_stab.wav"))
  {
    emit_sound(id, CHAN_WEAPON, g_szBoxingSound5, 1.0, ATTN_NORM, 0, PITCH_NORM)
    return FMRES_SUPERCEDE
  }
  }
 }
 return FMRES_IGNORED;
}


akcaliberg 08-05-2013 15:12

Re: Trying to change 2 emit sound
 
Quote:

register_forward(FM_EmitSound, "EmitSound")
public fw_emitsound

->

public EmitSound

ironskillz1 08-05-2013 18:13

Re: Trying to change 2 emit sound
 
Quote:

Originally Posted by akcaliberg (Post 2006372)
public fw_emitsound

->

public EmitSound

Now the server crashes
evrytime these sound should play

akcaliberg 08-05-2013 19:10

Re: Trying to change 2 emit sound
 
You can't change weapons' sounds except knife.

ironskillz1 08-06-2013 06:03

Re: Trying to change 2 emit sound
 
Quote:

Originally Posted by akcaliberg (Post 2006495)
You can't change weapons' sounds except knife.

You can change the he_bounce sound

MrKiller2010 08-06-2013 06:17

Re: Trying to change 2 emit sound
 
Quote:

Originally Posted by ironskillz1 (Post 2006732)
You can change the he_bounce sound

This is what i use:

PHP Code:

if(!is_user_alive(id)) 
        return 
FMRES_IGNORED
    
    
new temp[2], weapon get_user_weapon(idtemp[0], temp[1])
    if(
weapon == CSW_KNIFE)
    {
        if(
g_iCurrentGame == GAME_BOXING)
        {
            if(
equal(sample,"weapons/knife_hit1.wav")) 
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit1.wav"1.0ATTN_NORM0PITCH_NORM)
            }
            else if(
equal(sample,"weapons/knife_hit2.wav")) 
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit2.wav"1.0ATTN_NORM0PITCH_NORM)  
            }
            else if(
equal(sample,"weapons/knife_hit3.wav")) 
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit3.wav"1.0ATTN_NORM0PITCH_NORM)  
            }
            else if(
equal(sample,"weapons/knife_hit4.wav")) 
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit4.wav"1.0ATTN_NORM0PITCH_NORM)
            }
            else if(
equal(sample,"weapons/knife_stab.wav")) 
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_stab.wav"1.0ATTN_NORM0PITCH_NORM)  
            }
            
            return 
FMRES_SUPERCEDE
        
}
    }
    
    return 
FMRES_IGNORED 


ironskillz1 08-06-2013 06:39

Re: Trying to change 2 emit sound
 
Both sound Changes work when i dont combine them.
But when i combine them (He_bounce and knife sound)

The server goes to shit

akcaliberg 08-06-2013 12:14

Re: Trying to change 2 emit sound
 
I have tried to change he bounce sound before. But it gave an error like Channel = 115 :/

joropito 08-06-2013 20:38

Re: Trying to change 2 emit sound
 
Change this

Code:

public fw_emitsound(id, ent,channel,sample[],Float:volume,Float:atten,flags,pitch) {
to this

Code:

public fw_emitsound(id, channel,sample[],Float:volume,Float:atten,flags,pitch) {

ironskillz1 08-06-2013 20:53

Re: Trying to change 2 emit sound
 
Quote:

Originally Posted by joropito (Post 2007362)
Change this

Code:

public fw_emitsound(id, ent,channel,sample[],Float:volume,Float:atten,flags,pitch) {
to this

Code:

public fw_emitsound(id, channel,sample[],Float:volume,Float:atten,flags,pitch) {

Dude i want to change both sounds He_bounce and Knife


All times are GMT -4. The time now is 15:49.

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