AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sound change (https://forums.alliedmods.net/showthread.php?t=205064)

RuRuRu612754 01-06-2013 11:41

Sound change
 
hello.

this is part of the code that are currently written by me.
this code can change possible by other sounds.
it is not possible to change this sound only ctwin, terwin.
there is a problem with my code?
help me.

thanks.

source code here:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>

public plugin_init() 

    
register_plugin("PLUGIN""VERSION""AUTHOR")

    
register_forward(FM_EmitSound"forward_fm_emitsound")
}

new const 
new_ctwin[][] =
{
    
"newsound/ctwin.wav"
}

new const 
new_terwin[][] =
{
    
"newsound/terwin.wav"
}

public 
forward_fm_emitsound(idiChannelsample[], Float:fVolumeFloat:fAttenuationiFlagsiPitch)
{
    if(
equali(sample"radio/ctwin.wav"))
    {
        
engfunc(EngFunc_EmitSoundidCHAN_STATICnew_ctwin1.0ATTN_NORM0PITCH_NORM)
    }
    if(
equali(sample"radio/terwin.wav"))
    {
        
engfunc(EngFunc_EmitSoundidCHAN_STATICnew_terwin1.0ATTN_NORM0PITCH_NORM)
    }

    return 
FMRES_SUPERCEDE



alonelive 01-07-2013 04:01

Re: Sound change
 
Try with

PHP Code:

register_event("SendAudio""Terrorists_win" "a""2&%!MRAD_terwin");
register_event("SendAudio""CounterTerrorists_win""a""2&%!MRAD_ctwin");

public 
Terrorists_win() {
 
client_cmd(0"spk 1.wav");
}

public 
CounterTerrorists_win() {
 
client_cmd(0"spk 2.wav");



guipatinador 01-09-2013 06:43

Re: Sound change
 
Untested,

Code:
public forward_fm_emitsound(id, iChannel, sample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch) {     if(equali(sample, "radio/ctwin.wav"))     {         engfunc(EngFunc_EmitSound, id, CHAN_STATIC, new_ctwin, 1.0, ATTN_NORM, 0, PITCH_NORM)         return FMRES_SUPERCEDE     }     if(equali(sample, "radio/terwin.wav"))     {         engfunc(EngFunc_EmitSound, id, CHAN_STATIC, new_terwin, 1.0, ATTN_NORM, 0, PITCH_NORM)         return FMRES_SUPERCEDE     }         return FMRES_IGNORED }

RuRuRu612754 01-10-2013 12:14

Re: Sound change
 
@alonelive and guipatinador
thanks for reply and help.
i'm going test it.

RuRuRu612754 01-10-2013 14:02

Re: Sound change
 
worked.
however, play with double sound with the original sound.
Quote:

Originally Posted by alonelive (Post 1868711)
Try with

PHP Code:

register_event("SendAudio""Terrorists_win" "a""2&%!MRAD_terwin");
register_event("SendAudio""CounterTerrorists_win""a""2&%!MRAD_ctwin");

public 
Terrorists_win() {
 
client_cmd(0"spk 1.wav");
}

public 
CounterTerrorists_win() {
 
client_cmd(0"spk 2.wav");



do not work.T^T
Quote:

Originally Posted by guipatinador (Post 1870159)
Untested,

Code:
public forward_fm_emitsound(id, iChannel, sample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch) {     if(equali(sample, "radio/ctwin.wav"))     {         engfunc(EngFunc_EmitSound, id, CHAN_STATIC, new_ctwin, 1.0, ATTN_NORM, 0, PITCH_NORM)         return FMRES_SUPERCEDE     }     if(equali(sample, "radio/terwin.wav"))     {         engfunc(EngFunc_EmitSound, id, CHAN_STATIC, new_terwin, 1.0, ATTN_NORM, 0, PITCH_NORM)         return FMRES_SUPERCEDE     }         return FMRES_IGNORED }

write by me code.
this is also worked.
however, play with double sound with the original sound.
PHP Code:

#include <amxmodx> 
#include <cstrike> 
#include <fakemeta> 
#include <fun> 
#include <hamsandwich> 

public plugin_init()  
{  
    
register_plugin("PLUGIN""VERSION""AUTHOR"

    
register_message(get_user_msgid("TextMsg"), "message_textmsg"); 
}


public 
message_textmsg( const MsgId, const MsgDest, const MsgEntity )
{
    static const 
TerroristMsg[] = "#Terrorists_Win";
    static const 
CTMsg       [] = "#CTs_Win";

    static 
Messagesizeof TerroristMsg ];
    
get_msg_arg_string2MessagecharsmaxMessage ) );

    if ( 
equalMessageTerroristMsg ))
    {
        
client_cmd(0"spk radio/ctwin.wav");
    }
    
    else if ( 
equalMessageCTMsg ))
    {
        
client_cmd(0"spk radio/terwin.wav");
    }



alonelive 01-14-2013 04:22

Re: Sound change
 
PHP Code:

register_event("SendAudio""Terrorists_win" "a""2&%!MRAD_terwin");
register_event("SendAudio""CounterTerrorists_win""a""2&%!MRAD_ctwin");

public 
Terrorists_win() {
 
client_cmd(0"spk 1.wav");
 return 
PLUGIN_HANDLED
}

public 
CounterTerrorists_win() {
 
client_cmd(0"spk 2.wav");
 return 
PLUGIN_HANDLED



RuRuRu612754 01-26-2013 20:25

Re: Sound change
 
Quote:

Originally Posted by alonelive (Post 1873237)
PHP Code:

register_event("SendAudio""Terrorists_win" "a""2&%!MRAD_terwin");
register_event("SendAudio""CounterTerrorists_win""a""2&%!MRAD_ctwin");

public 
Terrorists_win() {
 
client_cmd(0"spk 1.wav");
 return 
PLUGIN_HANDLED
}

public 
CounterTerrorists_win() {
 
client_cmd(0"spk 2.wav");
 return 
PLUGIN_HANDLED



thanks.
i will try it.


All times are GMT -4. The time now is 13:26.

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