View Single Post
  #7  
Old 09-11-2011, 11:51 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
If it's for playing music in a level for all players, why are all of you writing gui/weapon scripts? Level npc scripting approach seems simpler and more appropriate for the situation to me:
PHP Code:
function onCreated() {
  
setshape(13232);
  
setSong("defaultsongplaying.mp3");
}

function 
onPlayerChats() {
  
temp.tokens player.chat.tokenize();
  if (
tokens[0] == "playsong") {
    if (
fileexists(tokens[1])) {
      if (
tokens[1] != this.attr[10]) {
        
setSong(tokens[1]);
      }
    }
  }
}

function 
setSong(temp.filename) {
  
this.attr[10] = filename;
  
triggeraction(this.1this.1"SongChanged"filename);
}

//#CLIENTSIDE
function onCreated() {
  
setshape(13232);
}

function 
onPlayerEnters() {
  
setSong(this.attr[10]);
}

function 
onActionSongChanged(temp.filename) {
  
setSong(filename);
}

function 
setSong(temp.filename) {
  
stopmusic();
  
playlooped(filename);

__________________
Reply With Quote