AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Play 2 Sounds At The Same Time (https://forums.alliedmods.net/showthread.php?t=229017)

3xit. 10-31-2013 00:49

Play 2 Sounds At The Same Time
 
Hello, I'm having trouble with trying to get to play 2 different sounds at the same time to different teams/players. Example: I want to play a sound on one player and play a different sounds to the players team at the same time.

Any help is appreciated thanks.

ConnorMcLeod 10-31-2013 01:38

Re: Play 2 Sounds At The Same Time
 
I don't see where is your problem...

3xit. 10-31-2013 01:49

Re: Play 2 Sounds At The Same Time
 
I want to know how I can play 2 sounds at the same time but to different players/teams. Example is the player who captures the flag hears a sound saying "you have captured the flag". And his team will here "we have captured the flag".

ConnorMcLeod 10-31-2013 02:10

Re: Play 2 Sounds At The Same Time
 
PHP Code:

PlayWinSound(iWinnerIndex, const szWinnerSound[]="", const szWinningTeamSound[]="")
{
    if( !
is_user_connected(iWinnerIndex) )
    {
        return 
0;
    }

    static const 
cmd[] = "spk %s";

    if( 
szWinnerSound[0] )
    {
        
client_cmd(iWinnerIndexcmdszWinnerSound);
    }

    if( 
szWinningTeamSound[0] )
    {
        new 
players[32], numidszTeam[11];
        
get_user_team(idszTeamcharsmax(szTeam));
        
get_players(playersnum"ce"szTeam);
        for(--
numnum>=0num--)
        {
            
id players[num];
            if( 
id != iWinnerIndex )
            {
                
client_cmd(idcmdszWinningTeamSound);
            }
        }
    }

    return 
1;



3xit. 10-31-2013 03:02

Re: Play 2 Sounds At The Same Time
 
I'm sorry I cant get this to work.

PHP Code:

BlueSounds(iWinnerIndex, const szWinnerSound[]="TF/youhavetheenemyflag.wav", const szWinningTeamSound[]="TF/wehavetheenemyflag.wav"

    if( !
is_user_connected(iWinnerIndex) ) 
    { 
        return 
0
    } 
    static const 
cmd[] = "spk %s"
    if( 
szWinnerSound[0] ) 
    { 
        
client_cmd(iWinnerIndexcmdszWinnerSound); 
    } 
    if( 
szWinningTeamSound[0] ) 
    { 
        new 
players[32], numidszTeam[11]; 
        
get_user_team(idszTeamcharsmax(szTeam)); 
        
get_players(playersnum"ce"szTeam); 
        for(--
numnum>=0num--) 
        { 
            
id players[num]; 
            if( 
id != iWinnerIndex 
            { 
                
client_cmd(idcmdszWinningTeamSound); 
            } 
        } 
    } 
    return 
1



ConnorMcLeod 10-31-2013 12:52

Re: Play 2 Sounds At The Same Time
 
PHP Code:

BlueSounds(id)
{
    
PlayWinSound(id"TF/youhavetheenemyflag.wav""TF/wehavetheenemyflag.wav");
}

PlayWinSound(iWinnerIndex, const szWinnerSound[]="", const szWinningTeamSound[]=""

    if( !
is_user_connected(iWinnerIndex) ) 
    { 
        return 
0
    } 

    static const 
cmd[] = "spk %s"

    if( 
szWinnerSound[0] ) 
    { 
        
client_cmd(iWinnerIndexcmdszWinnerSound); 
    } 

    if( 
szWinningTeamSound[0] ) 
    { 
        new 
players[32], numidszTeam[11]; 
        
get_user_team(idszTeamcharsmax(szTeam)); 
        
get_players(playersnum"ce"szTeam); 
        for(--
numnum>=0num--) 
        { 
            
id players[num]; 
            if( 
id != iWinnerIndex 
            { 
                
client_cmd(idcmdszWinningTeamSound); 
            } 
        } 
    } 

    return 
1



3xit. 11-01-2013 09:49

Re: Play 2 Sounds At The Same Time
 
Quote:

Originally Posted by ConnorMcLeod (Post 2055171)
PHP Code:

BlueSounds(id)
{
    
PlayWinSound(id"TF/youhavetheenemyflag.wav""TF/wehavetheenemyflag.wav");
}

PlayWinSound(iWinnerIndex, const szWinnerSound[]="", const szWinningTeamSound[]=""

    if( !
is_user_connected(iWinnerIndex) ) 
    { 
        return 
0
    } 

    static const 
cmd[] = "spk %s"

    if( 
szWinnerSound[0] ) 
    { 
        
client_cmd(iWinnerIndexcmdszWinnerSound); 
    } 

    if( 
szWinningTeamSound[0] ) 
    { 
        new 
players[32], numidszTeam[11]; 
        
get_user_team(idszTeamcharsmax(szTeam)); 
        
get_players(playersnum"ce"szTeam); 
        for(--
numnum>=0num--) 
        { 
            
id players[num]; 
            if( 
id != iWinnerIndex 
            { 
                
client_cmd(idcmdszWinningTeamSound); 
            } 
        } 
    } 

    return 
1



The player can hear the sounds but no his team, im not sure how to fix this.

ConnorMcLeod 11-01-2013 11:36

Re: Play 2 Sounds At The Same Time
 
Make sure sounds are "hearable"

Type in your client console : spk SOUND_NAME, as it is done in plugin, and check you hear it.


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

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