AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   playing a wav (https://forums.alliedmods.net/showthread.php?t=28874)

SuperDuper 05-24-2006 20:58

playing a wav
 
Is there a way to make a plugin so at the end of each round it plays a short wav.?

Hawk552 05-24-2006 21:17

The first thing you want to do is register the event.

Code:
register_event("SendAudio", "fnRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")

Next, you want to precache the sound

Code:
new g_szSound[] = "sound.wav" public plugin_precache()        precache_sound(g_szSound)

Next, you want to play it on the event.

Code:
public fnRoundEnd()        client_cmd(0,"spk %s",g_szSound)

So you have something like this:

Code:
#include <amxmodx> #include <amxmisc> new g_szSound[] = "sound.wav" public plugin_init() {     register_plugin("Endround Sound","1.0","Hawk552")         register_event("SendAudio", "fnRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw") } public plugin_precache()     precache_sound(g_szSound) public fnRoundEnd()     client_cmd(0,"spk %s",g_szSound)

SuperDuper 05-24-2006 21:33

so what order would i put those commands in?

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "GoodGame" #define VERSION "1.0" #define AUTHOR "SuperDuper" public plugin_init() {     register_plugin("goodgame", "1.0", "SuperDuper")     register_concmd("amx_justin" , "goodgame" , ADMIN_LEVEL_A); } // The .wav file------------------------------------------------------       public plugin_precache() {     precache_sound("desktop/music/gg.wav") }

heh im getting better :D

Hawk552 05-24-2006 21:35

I don't think it really matters...

SuperDuper 05-24-2006 21:38

so how does this look?

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "GoodGame" #define VERSION "1.0" #define AUTHOR "SuperDuper"     public plugin_init()     {     register_plugin("goodgame", "1.0", "SuperDuper")     register_concmd("amx_justin" , "goodgame" , ADMIN_LEVEL_A);     }     // The .wav file------------------------------------------------------           public plugin_precache()     {     precache_sound("desktop/music/gg.wav")     }     new g_szSound[] = "sound.wav"     public plugin_init()     {     register_plugin("Endround Sound","1.0","Hawk552")           register_event("SendAudio", "fnRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")     }         public plugin_precache()     precache_sound(g_szSound)     public fnRoundEnd()     client_cmd(0,"spk %s",g_szSound)         public plugin_precache()     {     precache_sound("desktop/music/gg.wav")     }

SuperDuper 05-24-2006 21:41

wait no more like this?

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "GoodGame" #define VERSION "1.0" #define AUTHOR "SuperDuper"     // The .wav file------------------------------------------------------           public plugin_precache()     {     precache_sound("desktop/music/gg.wav")     }     new g_szSound[] = "sound.wav"     public plugin_init()     {     register_plugin("Endround Sound","1.0","Hawk552")           register_event("SendAudio", "fnRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")     }         public plugin_precache()     precache_sound(g_szSound)     public fnRoundEnd()     client_cmd(0,"spk %s",g_szSound)         public plugin_precache()     {     precache_sound("desktop/music/gg.wav")     }

Hawk552 05-24-2006 21:47

You have 2 precache_sound's, and you never use g_szSound to its full potential.

Please, if you ever want me to help you again, do not indent like that.

allenwr 05-24-2006 21:51

errgggg

You need to define it more i think
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new g_szSound[] = "sound.wav" public fnRoundEnd() {     client_cmd(0,"spk %s",g_szSound) } public plugin_precache() {     precache_sound("misc/sound.wav")         return PLUGIN_CONTINUE } public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("SendAudio", "fnRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw") }

i think that works.

SuperDuper 05-24-2006 21:52

Lol, sry bout the indenting, il stop doing that.

hows this then?

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "GoodGame" #define VERSION "1.0" #define AUTHOR "SuperDuper" // The .wav file------------------------------------------------------       public plugin_precache() { precache_sound("desktop/music/gg.wav") } new g_szSound[] = "sound.wav" public plugin_init() { register_plugin("Endround_GoodGame","1.0","SuperDuper")       register_event("SendAudio", "fnRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw") }     public fnRoundEnd() client_cmd(0,"spk %s",g_szSound)

allenwr 05-24-2006 21:52

Quote:

Originally Posted by Hawk552
You have 2 precache_sound's, and you never use g_szSound to its full potential.

Please, if you ever want me to help you again, do not indent like that.

be nice, he is a coding newbie like me.


All times are GMT -4. The time now is 16:30.

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