Raised This Month: $ Target: $400
 0% 

play sound when cfg file is loaded?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
amokossi
Senior Member
Join Date: Apr 2008
Old 10-24-2012 , 06:47   play sound when cfg file is loaded?
Reply With Quote #1

Hi I got a plugin with a menu. If an option is votet a config (test.cfg) is loaded. Is it possible to activate a soundfile mp3 in the config file to be played? I know it is possible to play the mp3 file when I program it in the plugin via
Code:
client_cmd(0,"mp3 play sound/misc/testsnd.mp3")        ;
But can't I put some line into the .cfg file which plays the sound as soon as this cfg file is loaded?


regards
Amokossi
amokossi is offline
Send a message via ICQ to amokossi Send a message via MSN to amokossi
Bos93
Veteran Member
Join Date: Jul 2010
Old 10-24-2012 , 07:34   Re: play sound when cfg file is loaded?
Reply With Quote #2

maybe: http://forums.alliedmods.net/showpos...89&postcount=9 ?
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
amokossi
Senior Member
Join Date: Apr 2008
Old 10-24-2012 , 07:54   Re: play sound when cfg file is loaded?
Reply With Quote #3

Not really. The problem is the following.

There is a plugin which let me choose a mod to play on mapstart. If the mod is choosen a config file is loaded. I thought about adding a line like "mp3 play sound/misc/Rollthedice.mp3" into the config.

As I don't really understand the code I need to do it this way. If I could see how the config file is choosen I could for sure add the "mp3 play ... " into the code after the choice of the cfg file.

The result should be:
Roll the Dice is choosen -> Mp3 sound: Roll the dice choosen
Gungame choosen -> Mp3 sound: Gungame choosen
Funweapons -> Mp3 sound: Funweapons choosen

This seem to be the code of the Plugin where the result of the menu is generated.

Code:
public CheckVotes()
{
        new best = 9;
        new noVotes = 0;

        for(new a = 0; a < 9; a++)
        {
                if(count[a] > count[best])
                        best = a;
                else
                        noVotes++;
        }

        if(noVotes == 10)
                best = 9;

        if(best != 9)
        {
                client_print(0, print_chat, "%s won with %d votes", menuBody[best], count[best]);
              

                #if defined DEBUG
                server_print("%s won with %d votes", menuBody[best], count[best]);
                #endif
        }
        else if(best == 9)
        {
                client_print(0, print_chat, "%s won with %d votes", "No mod", count[best]);

                #if defined DEBUG
                server_print("%s won with %d votes", "No mod", count[best]);
                #endif
        }

        loaded = best;
        SetCvars(best);
}
In my case I got 3 mods to choose. But don't see a way to tell in this code if Menu item 1 won play sound "sound/misc/mod1.mp3"..

So I'm thinking about the option to put this sound into the .cfg which will be loaded when a mod won.


Hope someone can help.

Last edited by amokossi; 10-24-2012 at 07:56.
amokossi is offline
Send a message via ICQ to amokossi Send a message via MSN to amokossi
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-24-2012 , 20:08   Re: play sound when cfg file is loaded?
Reply With Quote #4

Quote:
Originally Posted by amokossi View Post
Hi I got a plugin with a menu. If an option is votet a config (test.cfg) is loaded. Is it possible to activate a soundfile mp3 in the config file to be played? I know it is possible to play the mp3 file when I program it in the plugin via
Code:
client_cmd(0,"mp3 play sound/misc/testsnd.mp3")        ;
But can't I put some line into the .cfg file which plays the sound as soon as this cfg file is loaded?
Yes. It will require you to write a plugin with a function that plays the sound. Then, in the cfg file, call that function.
__________________
fysiks is offline
Reply



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


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