smooshie

Plug.dj repeat check (untested)

Jul 6th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Models.history.load();
  2. var skippedsongs = new Array();
  3.  
  4. API.addEventListener(API.DJ_UPDATE, repeatcheck);
  5.  
  6. function inarray(array, id) {
  7.     for(var i=0;i<array.length;i++) {
  8.         if(array[i][0].id == id) {
  9.             return true;
  10.         }
  11.     }
  12.     return false;
  13. }
  14.  
  15. function repeatcheck(user) {
  16.  
  17. var historylist=Models.history.data;
  18. var currentID=Models.room.data.media.cid;
  19.  
  20. for(var j=1; j<50;j++) {
  21.  
  22. if (historylist[j].media.cid == currentID) {
  23.  
  24. var result = inarray(skippedsongs, currentID);
  25.  
  26. if (result === false) {
  27. API.moderateForceSkip();
  28. API.sendChat("Sorry, that song's still in history");
  29. skippedsongs.push(currentID);
  30. }
  31. }
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment