View difference between Paste ID: hXCNadQe and J1DxBtWV
SHOW: | | - or go back to the newest paste.
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-
if (Models.history.data[j].media.cid == Models.room.data.media.cid) {
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
}