PDA

View Full Version : Music when u connect to server


johnnyskid
11-17-2006, 11:27 PM
hello,

i know that there is a few plugins out there that allow you to hear music when you connect to a server.


Where can I find the best one?

diamond-optic
11-18-2006, 12:58 AM
search around the amxmodx.org forums (http://www.amxmodx.org/forums/index.php) for non-dod specific stuffers... you'll find a few different versions of a plugin called something like 'loadingsong' or 'loadingsound' something like that...

=|[76AD]|= TatsuSaisei
11-18-2006, 10:40 AM
hello,

i know that there is a few plugins out there that allow you to hear music when you connect to a server.


Where can I find the best one?


#include <amxmodx>
#include <engine>
public plugin_init() {
register_plugin("The Box - Connect Song","76.0","TatsuSaisei")
return PLUGIN_CONTINUE
}
public plugin_precache() {
precache_generic("sound/mp3s/theboxbit.mp3")
return PLUGIN_CONTINUE
}
public client_connect(id) {
client_cmd(id,"MP3Volume 1.0")
client_cmd(id,"mp3 play sound/mp3s/theboxbit.mp3")
return PLUGIN_CONTINUE
}


This is as "simple" as you can get.....

but hey, how about a random song from a list ?


#include <amxmodx>

// change maxsounds # to equal number of songs to randomly play
#define Maxsounds 4

// # of songs listed here MUST be equal to # in maxsounds
new soundlist[Maxsounds][] = {"bodies","disturbed","comfortablynumb","systemofthedown"}

// downloads files to clients if they not have it
// be sure to add another line if you add more songs
public plugin_precache() {
precache_generic("sound/misc/bodies.mp3")
precache_generic("sound/misc/disturbed.mp3")
precache_generic("sound/misc/comfortablynumb.mp3")
precache_generic("sound/misc/systemofthedown.mp3")
return PLUGIN_CONTINUE
}
// DONT TOUCH CODE BELOW THIS - Initialization
public plugin_init() {
register_plugin("Random Connect Songs","76.0","TatsuSaisei")
return PLUGIN_CONTINUE
}
//plays one of the songs randomly
public client_connect(id) {
new i
i = random_num(0,Maxsounds-1)
client_cmd(id,"MP3Volume 1.0")
client_cmd(id,"mp3 play sound/misc/%s",soundlist[i])
return PLUGIN_CONTINUE
}

=|[76AD]|= TatsuSaisei
11-22-2006, 01:53 AM
btw, if your MP3Volume is set to 0 you will never hear any mp3s playing... I altered code to "fix" this for now by manually setting it to a value...

diamond-optic
11-22-2006, 08:09 PM
you should have it check that its set to 0 first :-\

=|[76AD]|= TatsuSaisei
11-22-2006, 11:45 PM
you should have it check that its set to 0 first :-\

you know... I never had any luck with that function working for me (query_client_cvar) but the other day I did run across a function that might serve the same function and work.. but I had not gotten to it yet...

diamond-optic
11-23-2006, 12:56 AM
hmm really?

i have it in the shell shock plugin.. and it seems to be working in most cases (except the occasional person says it doesnt work)

=|[76AD]|= TatsuSaisei
11-23-2006, 02:54 AM
hmm really?

i have it in the shell shock plugin.. and it seems to be working in most cases (except the occasional person says it doesnt work)
That is where I originally got the idea to check a clients setting... and I am one of those people it did not work for, nor any of the others I asked... I actually even made a few test lines of code that would simply report back what the setting was in chat... everyone I asked who saw their message come up stated that the message was telling them it was always zero...

|OnEHiTwOnDeR|SoCal
04-14-2007, 10:19 PM
i realize im like reopening a thread from yrsss ago but would this make the client have t0 download the sound(mp3)

diamond-optic
04-15-2007, 12:12 AM
yeah it would..

|OnEHiTwOnDeR|SoCal
04-15-2007, 03:44 AM
thanks d - o

meathead
09-20-2007, 04:15 PM
Hey,
Using this plugin and it is working but with 3 problems.

server failed to download 1 of the mp3s. I changed the list and it did it again to a different mp3.

Missing wave file riff chunks (this message is repeated about 6 times)

When the precache is finished the song switches to a different song.

Any way to fix?

Or any plugins that work better? All the plugins on alliedmodders are followed by pages of problems. :(

=|[76AD]|= TatsuSaisei
09-20-2007, 06:00 PM
Missing wave file riff chunks (this message is repeated about 6 times)

change precache_sound to precache_generic

(i edited my above post to reflect these changes)

meathead
09-21-2007, 04:37 AM
Server fails to dowload any of the files. I deleted them from my pc and tried again, still the same. Music still plays, if you had the files. Still changes songs between precahe and game but no missing riff wave chunks.

No, I just noticed I didn't update the code correctly. Sorry. Trying again!

diamond-optic
09-22-2007, 12:12 AM
which switching from precache_sound to precache_generic you need to add the /sound/ or whatever part of the directory to the file name

meathead
09-22-2007, 03:17 AM
Yes, I saw that finally and fixed it. Thanks Diamond.
Now I get 1 of the mp3 files failed to download. Checking my script again for a typo. Its always the same one,(Jump), so it must be a typo. Then I get error messages that all the map sound files on the fast html failed to upload. They are already on my pc, so I go to game no problem. Next, I am now having lag in game. Appears to be whenever they're sounds being made. The sound stutters badly, and I see a severe stutter when trying to move around. Could be a separate issue caused by all the new steam stuff. Don't know yet.
Do I need to change my mp3s to just short snippets? Right now they are full size. Cut back from 12 to 8 songs today, but saw no improvement.
Does the cache get cleared out on its own, or do I just need to minimize the amount of the files?

Thanks Guys
Sorry to be a pain and appreciate your help very much!!!!!
Meathead

#include <amxmodx>

// change maxsounds # to equal number of songs to randomly play
#define Maxsounds 8

// # of songs listed here MUST be equal to # in maxsounds
new soundlist[Maxsounds][] = {"Spirit","Freak","Mtv","Girls","Mother","Fantasy","Mudshovel","Jump"}

// downloads files to clients if they not have it
// be sure to add another line if you add more songs
public plugin_precache() {
precache_generic("sound/misc/Spirit.mp3")
precache_generic("sound/misc/Freak.mp3")
precache_generic("sound/misc/Mtv.mp3")
precache_generic("sound/misc/Attack.mp3")
precache_generic("sound/misc/Girls.mp3")
precache_generic("sound/misc/Mother.mp3")
precache_generic("sound/misc/Jump.mp3")
precache_generic("sound/misc/Fantasy.mp3")
precache_generic("sound/misc/Mudshovel.mp3")


return PLUGIN_CONTINUE
}
// DONT TOUCH CODE BELOW THIS - Initialization
public plugin_init() {
register_plugin("Random Connect Songs","76.0","TatsuSaisei")
return PLUGIN_CONTINUE
}
//plays one of the songs randomly
public client_connect(id) {
new i
i = random_num(0,Maxsounds-1)
client_cmd(id,"MP3Volume 1.0")
client_cmd(id,"mp3 play sound/misc/%s",soundlist[i])
return PLUGIN_CONTINUE
}

=|[76AD]|= TatsuSaisei
09-22-2007, 09:08 AM
Next, I am now having lag in game. Appears to be whenever they're sounds being made. The sound stutters badly, and I see a severe stutter when trying to move around. Could be a separate issue caused by all the new steam stuff. Don't know yet.
Do I need to change my mp3s to just short snippets?

This "plugin" will not cause any lag during the game. The sounds ONLY play upon entering server UNLESS fast downloads are not working properly, in which case the "lag" could be when a player joins the server and is getting the files directly from the game server as opposed to from the fast download host server... in which case EVERYONE will notice the lag at the same time...

and it doesn't matter how long or short the songs are... size will only affect the amount of time required to download the files...

Garion
09-22-2007, 03:45 PM
here's the plugin I use on my server to play music while people are connecting.

http://forums.alliedmods.net/showthread.php?t=46636&highlight=loading+sound

with that you just put the mp3 files in the correct folder and it will auto-download them and play them.
Tho I do have 1 sound that won't play but that may just simply be something wrong with that file.

meathead
09-24-2007, 01:42 PM
Thanks for the help. I might try that one. That would be less work if I change a song. Still using Tatsu's plugin for now. I am using the precache_sounds.
It has worked ever since I installed it. The missing riff wave chunks only shows up in console. No big deal. If I use the precache_generic, get way more failed to download messages for map items, (in console only). It works either way.
The 2 mp3's that wouldn't download must be incompatible with HL.
Another satisified customer!!!!
Thanks!
Meathead hobo

TigerMan4
11-14-2007, 10:19 AM
I have to put my 2cents in on this plugin.

I played on a server that had the random music at the join screen.

and let me tell you , if you don`t like the music choice of the server owner...you cant wait to either hit "CANCLE" or "join the game"

Me...I hit cancle....omg....not only was the music horrid ! but it was so loud that it about blew my speakers out.

SO CLICK !!!!! next server.

I mean...if you logged onto my server and were stucking listening to a very loud .mp3 of "Thank God I`m a country boy" or "YMCA" , how fast would you want to turn tail and go to another server ?

just my 2cents.

I know its in here somewhere....but....how the heck to make the .mp3s NOT play ? is it a cl_ command ? or an option ?

diamond-optic
11-14-2007, 09:43 PM
well "mp3 stop" in console will stop them, but while connecting you cant get to the console...

otherwise if its a server you play often or such, you could replace the mp3 file with a empty one


..if you want tho, in options on the audio tab, theres MP3 Volume...

TigerMan4
11-14-2007, 11:23 PM
I dont play often at all...infact...I`m going to delete the 10 files or whatever it was that it loaded on my pc...what a bunch of crappy songs...gah !