Advertisement
LGPvS

NMPB automatic playing specified songs

Sep 19th, 2018
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. var lastMsg="";
  2. songs=["0","5","6"]; //ids of songs here
  3. DateToMs=function(h,m,s){
  4. return parseInt(h*3600000) + parseInt(m*60000) + parseInt(s*1000);};
  5. DateToMs1=function(m,s){
  6. return parseInt(m*60000) + parseInt(s*1000);
  7. }
  8.  
  9. var songInt;
  10.  
  11. stringDateToMs=function(str){
  12. if(str.split(":").length==2){return DateToMs1(str.split(":")[0],str.split(":")[1]);};
  13. if(str.split(":").length==3){return DateToMs(str.split(":")[0],str.split(":")[1],str.split(":")[2]);};
  14. }
  15.  
  16. findLol11=function(str,a,b){
  17. return stringDateToMs(str.split(a)[str.split(a).length-1].replace(b,""));
  18. }
  19. pSong=function(ids,id,time){
  20.  
  21. setTimeout(function(){MPP.chat.send("/play "+ids[id]);
  22. },time);
  23.  
  24.  
  25. };
  26. MPP.client.on("a", function (msg) {
  27.  
  28. a = msg.a.split(' ');
  29. b = a[0];
  30. input = msg.a.substring(b.length).trim();
  31.  
  32. lastMsg=msg.a;
  33. });
  34.  
  35. pSongs=function(id,ids){var id1=id; MPP.chat.send("/p "+ids[id]); setTimeout(function(){var time1=findLol11(lastMsg,"[","]"); songsInt=setInterval(function(){clearInterval(songsInt); id1+=1; if(id1>ids.length-1){id1=0}; pSongs(id1,ids);},time1+1000); },1000); };
  36. playSongs=function(ids){pSongs(0,ids);};
  37. stopPlayingSongs=function(){
  38. clearInterval(songsInt);
  39. }
  40. playSongs(songs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement