Sign in to follow this  
Followers 0
BosnianArmy

Music Menu script

2 posts in this topic

Hey,

 

This is a "BETA" music menu from BraXi.org (the latest fixed version). The only bug what it got, is you can spam other songs, so the song what it plays rightnow you can choose another one immediately. Use this Music Menu at your own risc for spamming the music name infront ur screen in the server or fix it by your self and post it here if it stops the spamming part. But for the rest it works perfect!

 

 

Music Menu:

initMusic()
{
	level.music = [];
 
	i = 0;
	level.music[i]["artist"] = "Brennan Heart";
	level.music[i]["title"] = "Imaginary";
	level.music[i]["length"] = "03:22";
	level.music[i]["alias"] = "imaginary";
	
	i++;
	level.music[i]["artist"] = "SHM";
	level.music[i]["title"] = "Don't you worry child";
	level.music[i]["length"] = "03:28";
	level.music[i]["alias"] = "worry";
	
		i++;
	level.music[i]["artist"] = "David Guetta";
	level.music[i]["title"] = "Titanium";
	level.music[i]["length"] = "04:05";
	level.music[i]["alias"] = "tito";
		i++;
	level.music[i]["artist"] = "Flux Pavillion";
	level.music[i]["title"] = "Cracks";
	level.music[i]["length"] = "02:09";
	level.music[i]["alias"] = "cracks";
 
	precacheShader( "deathrun" );
	precacheShader( "white" );
}
 
musicMenu()
{
	self endon( "disconnect" );
	self endon( "death" );
	self endon( "spawned" );
	self endon( "joined_spectators" );
	self endon( "music thread terminated" );
 
	self thread onDeath();
	self thread onDisconnect();
 
	self.hud_music = [];
	// self cleanUp();
	self.selection = 0;
 
	// create huds
	i = 0;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 160, 200, 0.35, "left", "top", 2 );	// Background
	self.hud_music[i].sort = 880;
	self.hud_music[i] setShader( "deathrun", 320, 160 );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 270, 180, 1, "left", "top", 1.8 );
	self.hud_music[i].sort = 883;
	self.hud_music[i] setText( "^3-^7 Select Music ^3-^7" );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 270, 204, 0.93, "left", "top", 1.8 );
	self.hud_music[i].sort = 884;
	self.hud_music[i] setText( "Artist ^3-^7 Title ^3-^7 Length" );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 288, 360, 1, "center", "top", 1.4 );
	self.hud_music[i].sort = 885;
	self.hud_music[i] setText( "Press ^3[LMB]^7: Next Song    Press ^3[USE]^7: Play Song    Press ^3[Nade]^7: Close Menu" );
 
	i++;
	self.hud_music[i] = braxi\_mod::addTextHud( self, 235, 360, 1, "center", "bottom", 1.4 );
	self.hud_music[i].sort = 886;
	self.hud_music[i] setText( "Music Menu Made By ^1Braxi" );
 
	for( j = 0; j < level.music.size; j++ )
	{
		i++;
		// Artist - Title [lenght]
		////////////////////braxi\_mod::addTextHud(self, x, y, transparency, "x allignment", "y allignment", size(can't go below 1.3))
		self.hud_music[i] = braxi\_mod::addTextHud( self, 172, 230+(j*16), 0.93, "left", "top", 1.4 );
		self.hud_music[i].sort = 882;
		self.hud_music[i].font = "objective";
 
		entry = level.music[j];
		self.hud_music[i] setText( entry["artist"] + " ^3-^7 " + entry["title"] + " ^3[^7" + entry["length"] + "^3]^7" );
	}
 
	i++;
	self.hud_music[self.hud_music.size] = braxi\_mod::addTextHud( self, 167, 230, 0.4, "left", "top", 1.4 );	// Selection indicator
	self.hud_music[i].sort = 881;
	indicator = self.hud_music[self.hud_music.size-1];
	indicator setShader( "white", 306, 17 );
 
	while( self.sessionstate == "playing" )
	{
		wait 0.1;
 
		if( self attackButtonPressed() )	
		{
			self.hud_music[5+self.selection].alpha = 0.93; //unfocus previous item
 
			self.selection++;
			if( self.selection >= level.music.size )
				self.selection = 0;
 
			item = self.hud_music[5+self.selection];
			item.alpha = 1;
			indicator.y = item.y; // change indicator position
		}
		else if( self useButtonPressed() )
		{
			iPrintlnBold( "^3" + level.music[self.selection]["artist"]+"^7 - ^3" +level.music[self.selection]["title"] );
 
			ambientPlay( level.music[self.selection]["alias"], 3 );
			break;
		}
		else if( self fragButtonPressed() )
		{
			break; // close menu
		}
	}
 
	self cleanUp();
}
 
musictrig()
{
	trig = getEnt ("music", "targetname");
 
	while(1)
	{
		trig waittill("trigger", player);
		player musicMenu();
	}
}
 
onDisconnect()
{
	self endon( "music thread terminated" );
	self waittill( "disconnect" );
	self cleanUp();
}
 
onDeath()
{
	self endon( "disconnect" );
	self endon( "music thread terminated" );
	self waittill( "death" );
	self cleanUp();
}
 
 
cleanUp()
{
	if( !isDefined( self ) )
		return;
 
	if( isDefined( self.hud_music ) )
	{
		for( i = 0; i < self.hud_music.size; i++ )
		{
			if( isDefined( self.hud_music[i] ) )
				self.hud_music[i] destroy();
		}
	}
	self notify( "music thread terminated" );
}
0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0