Thread: Jukebox
View Single Post
  #1  
Old 04-11-2007, 02:36 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Jukebox

This is the Jukebox I made, many have requested the script, so I decided to release it to the public. Very simple, very easy to modify. If you use it, please if anyone asks give them the script. If you modify it (besides adding music), you can just give them the link to this, rather than the modified version.

Could probably be modded to play internet radio stations.

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
showJukebox();
}
function 
onKeyPressedcodekey )
{
  if ( 
key == "r" )
  {
    
setTimer0.05 );
    
Jukebox_Window.visible Jukebox_Window.visible 1;
    
GraalControl.makeFirstRespondertrue );
  }
}
function 
onWeaponFired()
{
  
say2"Press 'r' to toggle jukebox!" );
}
function 
showJukebox()
{
  
playing this.playing;
  
Jukebox_Window.destroy();
  new 
GuiWindowCtrl"Jukebox_Window" )
  {
    
profile "GuiBlueWindowProfile";
    
width 280;
    
height 120;
    
screenwidth width;
    
screenheight height;
    
canClose canMinimize true;
    
canMaximize canResize false;
    
visible false;
    
text "Jukebox for" SPC servername;
    
useownprofile true;
    
profile.transparency .9;
    new 
GuiMLTextCtrl"Jukebox_Text" )
    {
      
profile "GuiBlueTextProfile";
      
10;
      
30;
      
width 270;
      
height 20;
      
useownprofile true;
      
profile.align "center";
      
text "<center>Now playing:" SPC playing;
    }
    new 
GuiPopUpMenuCtrl"Jukebox_List" )
    {
      
profile "GuiBluePopUpMenuProfile";
      
width 260;
      
height 20;
      
10;
      
50;
      
textprofile "GuiBlueTextListProfile";
      
scrollprofile "GuiBlueScrollProfile";
      
clearRows();
      
temp.music = {
      { 
"SONG_NAME""SONG_URL" },
      { 
"SONG2_NAME""SONG2_URL" } ;
      for ( 
temp.0temp.temp.music.size(); temp.++ )
      {
        
withaddRow0temp.music[temp.i][0] ) )
        {
          
this.var = temp.music[temp.i][1];
        }
      }
      
setSelectedRow);
      
sort();
    }
    new 
GuiButtonCtrl"Jukebox_Stop" )
    {
      
profile "GuiBlueButtonProfile";
      
width 75;
      
height 30;
      
Jukebox_Window.width - ( width );
      
Jukebox_Window.height 40;
      
text "Stop Music";
    }
  }
  
stopmidi();
  
this.playing "[None]";
  
Jukebox_Text "Now playing: [None]";
}
function 
onTimeOut()
{
  
this.time += .05;;
  
setTimer0.05 );
}
function 
Jukebox_Stop.onAction()
{
  
stopmidi();
  
this.playing "[None]";
  
Jukebox_Text "Now playing: [None]";
}
function 
Jukebox_List.onSelect()
{
  if ( 
this.time )
  {
  
this.playing params[1];
  
Jukebox_Text.text "Now playing:" SPC params[1];
  
playJukebox_List.rows[params[2]].var );
  }
}
function 
onPlaytitlesong )
{
  
this.playing title;
  
Jukebox_Text.text "Now playing:" SPC title;
  
playsong );

Please leave feedback, my first released script.
__________________
Reply With Quote