| closedCreating a Music Player? |
| Started by unknown on 07-29-2009, 12:27 AM |
I need help making a music player for day of defeat. I want it where you do not have to precache music so no one will have to download each song. I just want it to have the commands say /music to bring up menu, and say /stop to stop the music. Don't tell me why don't you play music by binding it. I don't want to do that because I want each person to be able to listen to whatever they want.
Threads: 103
Joined: May 2005
the only way to play music directly thru halflife/dod would be with the spk command (for wavs) or the mp3 command (obviously for mp3s).. both of which will only play it to the client its executed on....nnlike in your other thread about pretty much the same thing, theres no way for a plugin or anything in halflife/dod to control another application to play musicnnnall music played via the game would have to be in the /sounds/ directory.. and i dont see how people would be able to play any of the music without downloading it, unless im not really following what youre saying here.. so forgive me if im not
Threads: 42
Joined: Sep 2007
open an auto-play embed in html from motd.txt via flash code - that streaming the music ...the music will continue streaming/playing if the player close the motd-window... and it is no need of precaching too!
Threads: 75
Joined: Jun 2006
Indeed, however there would be no way to stop that ghzero, not that I can think of. Diamond, you are correct in what he is asking, and you are also correct that the users will have to download a bunch of music IOT have a selection of music. This could also be a copyright infringement, and if say one of the players on your server was a band member, unlikely? who fucking knows, he could get your ip and sue you. So I would stay to the default sounds that come with HL.rnrnJust my thoughts!
Threads: 103
Joined: May 2005
well as far as the copyright stuff.. i wouldnt really be concerned with that... nnnthe odds of that happening are extremely incredibly low.. and im sure a dod server would be on the bottom of the list of what they might go after.. I would think p2p networks, torrent, and blogs would be more likely to be a target, and since they rarely are, i would think that it would be no issue at all with a game server
Threads: 23
Joined: Aug 2007
This looks like a good place for this.nk, so I tried to replace tatsueis music plugin with another. No dice. Some of you may have seen me looking for answer's on that other website. :)nSo I'm back to tat's plugin. Only thing it has a problem with is more than 8 files for some reason. No one can connect to the server if I use more. I've shortened all the files, so download time is 15 seconds for all on cable. Anyone tell me why it does this?nn
#include <amxmodx>n n// change maxsounds # to equal number of songs to randomly playn#define Maxsounds 8n n// # of songs listed here MUST be equal to # in maxsoundsnnew soundlist[Maxsounds][] = {"Beer1","Beer2","Beer3","Beer4","game","shortbodies","pron","Walk"}n n// downloads files to clients if they not have itn// be sure to add another line if you add more songsnpublic plugin_precache() { nprecache_sound("misc/game.mp3") nprecache_sound("misc/Beer2.mp3")nprecache_sound("misc/Beer1.mp3")nprecache_sound("misc/shortbodies.mp3") nprecache_sound("misc/Beer3.mp3") nprecache_sound("misc/Beer4.mp3") nprecache_sound("misc/pron.mp3") nprecache_sound("misc/Walk.mp3") nnreturn PLUGIN_CONTINUE n}n// DONT TOUCH CODE BELOW THIS - Initializationnpublic plugin_init() {nregister_plugin("Random Connect Songs","76.0","TatsuSaisei")nreturn PLUGIN_CONTINUEn}n//plays one of the songs randomlynpublic client_connect(id) {nnew ini = random_num(0,Maxsounds-1)nclient_cmd(id,"MP3Volume 1.0")nclient_cmd(id,"mp3 play sound/misc/%s",soundlist[i])nreturn PLUGIN_CONTINUE
Threads: 75
Joined: Nov 2007
I think this will help you. When you wanna add a new sound, add 1 to "Maxsounds" rnrnEg.rnrn
#define Maxsounds 8rnrnTo rnrn#define Maxsounds 9rnrnrnAfter that edit the soundlist:rnrnEg.rnrnnew soundlist[Maxsounds][] = {rn rn "Beer1", // 1rn "Beer2", // 2rn "Beer3", // 3 rn "Beer4", // 4rn "game", // 5rn "shortbodies", // 6rn "pron", // 7rn "Walk" // 8rn}rnrntornrnnew soundlist[Maxsounds][] = {rn rn "Beer1", // 1rn "Beer2", // 2rn "Beer3", // 3 rn "Beer4", // 4rn "game", // 5rn "shortbodies", // 6rn "pron", // 7rn "Walk", // 8rn "New_Song" // 9rn}rnrnAnd thats it. Put the files in sound/misc as before and they must be .mp3, as before.rnrnFull code:rnrn/* Plugin generated by AMXX-Studio */rn////////////////////////////////////////////////////////////////////////////////////////////////////rn#include <amxmodx>rn////////////////////////////////////////////////////////////////////////////////////////////////////rn#define Maxsounds 9rn////////////////////////////////////////////////////////////////////////////////////////////////////rnnew soundlist[Maxsounds][] = {rn rn "Beer1", // 1rn "Beer2", // 2rn "Beer3", // 3 rn "Beer4", // 4rn "game", // 5rn "shortbodies", // 6rn "pron", // 7rn "Walk", // 8rn "New_Song" // 9, remember #define Maxsounds to 9rn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rnpublic plugin_precache() rn{ rn new cursound[32]rn rn for (new i = 0; i < Maxsounds; i++) rn {rn formatex(cursound, sizeof cursound - 1, "misc/%s.mp3", soundlist[i])rn rn if(file_exists(cursound))rn precache_sound(soundlist[i])rn rn elsern log_amx("[Random Connect Songs] Cound't find sound file %s to precache.", cursound)rn }rn rn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rnpublic plugin_init() rn{rn register_plugin("Random Connect Songs","76.0","TatsuSaisei")rn return PLUGIN_CONTINUErn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rnpublic client_connect(id) rn{rn new i = random_num(0, Maxsounds - 1 )rn client_cmd(id, "MP3Volume 1.0")rn client_cmd(id, "mp3 play sound/misc/%s", soundlist[i])rn return PLUGIN_CONTINUErn}rn////////////////////////////////////////////////////////////////////////////////////////////////////Threads: 23
Joined: Aug 2007
Music playing fine, but not precached.
Threads: 103
Joined: May 2005
Music playing fine, but not precached.nnthe file_exist check is going to need the /sound/ part of the file namenand the precache_sound is going to need the /misc/ in the filenamennyou can probably add /misc/ before each file listed in soundlist.. and change the /misc/ in the formatex to /sound/nthen in the client_cmd(id, "mp3 play sounds/misc/%s, soundlist[i]), just take out the misc/ part
Threads: 23
Joined: Aug 2007
***Edit****nPrecache works fine now, but same thing as the basic plugin. After 8 mp3's the server will not let anyone join. Must be a size limit to the cache or something.
Threads: 75
Joined: Nov 2007
weird, show code and attach the sounds.
Threads: 23
Joined: Aug 2007
started to upload sounds, but it's over 20M. I'm betting thats why. I didn't realize it was such a large amount. I haven't taken the time to shorten 2 of the sounds and they are both over 6M.
Threads: 23
Joined: Aug 2007
Only changed the new song name to this love.rnrnrn
/* Plugin generated by AMXX-Studio */rn////////////////////////////////////////////////////////////////////////////////////////////////////rn#include <amxmodx>rn////////////////////////////////////////////////////////////////////////////////////////////////////rn#define Maxsounds 9rn////////////////////////////////////////////////////////////////////////////////////////////////////rnnew soundlist[Maxsounds][] = {rn rn "/misc/Beer1", // 1rn "/misc/Beer2", // 2rn "/misc/Beer3", // 3 rn "/misc/Beer4", // 4rn "/misc/game", // 5rn "/misc/shortbodies", // 6rn "/misc/pron", // 7rn "/misc/walk", // 8rn "/misc/this love" // 9rn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rnpublic plugin_precache() rn{ rn new cursound[32]rn rn for (new i = 0; i < Maxsounds; i++) rn {rn formatex(cursound, sizeof cursound - 1, "sound/%s.mp3", soundlist[i])rn rn if(file_exists(cursound))rn precache_sound(soundlist[i])rn rn elsern log_amx("[Random Connect Songs] Cound't find sound file %s to precache.", cursound)rn }rn rn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rnpublic plugin_init() rn{rn register_plugin("Random Connect Songs","76.0","TatsuSaisei")rn return PLUGIN_CONTINUErn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rnpublic client_connect(id) rn{rn new i = random_num(0, Maxsounds - 1 )rn client_cmd(id, "MP3Volume 1.0")rn client_cmd(id, "mp3 play sound/%s", soundlist[i])rn return PLUGIN_CONTINUErn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rn/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERErn*{\ rtf1\ ansi\ deff0{\ fonttbl{\ f0\ fnil Tahoma;}}
\ viewkind4\ uc1\ pard\ lang1030\ f0\ fs16
\ par }rn*/rn

