Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function validateNames(){
  2.     for(var i = 0; i < data.length; i++){
  3.         var players = [];
  4.         players.push(data[i].cop);
  5.         players.push(data[i].medic);
  6.         players.push(data[i].vigilante);
  7.         for(var j = 0; j < data[i].vanilla_town.length; j++)
  8.             players.push(data[i].vanilla_town[j]);
  9.         for(var j = 0; j < data[i].mafia.length; j++)
  10.             players.push(data[i].mafia[j]);
  11.         for(var x = 0; x < data[i].n0.length; x++){
  12.             var found = false;
  13.             for(var a = 0; a < players.length; a++)
  14.                 if(players[a] == data[i].n0[x]){
  15.                     found = true;
  16.                     break;
  17.                 }
  18.             if(!found)
  19.                 console.log('NAME ERROR: Game ' + (i+1) + ' n0 [' + x + ']');
  20.         }
  21.         var found_save = false;
  22.         if(players[a] == data[i].save[x] || data[i].save == ''){
  23.             found_save = true;
  24.             break;
  25.         }
  26.         if(!found_save)
  27.             console.log('NAME ERROR: Game ' + i + ' n0_save');
  28.         var found_shot = false;
  29.         if(players[a] == data[i].save[x] || data[i].shot == ''){
  30.             found_shot = true;
  31.             break;
  32.         }
  33.         if(!found_shot)
  34.             console.log('NAME ERROR: Game ' + i + ' shot');
  35.         if(data[i].f3_win != null){
  36.             for(var x = 0; x < data[i].f3_win.length; x++){
  37.                 var found = false;
  38.                 for(var a = 0; a < players.length; a++){
  39.                     if(players[a] == data[i].f3_win[x]){
  40.                         found = true;
  41.                         break;
  42.                     }
  43.                 }
  44.                 if(!found)
  45.                     console.log('NAME ERROR: Game ' + i + ' f3_win [' + x + ']');
  46.             }
  47.         }
  48.         if(data[i].f3_loss != null){
  49.             for(var x = 0; x < data[i].f3_loss.length; x++){
  50.                 var found = false;
  51.                 for(var a = 0; a < players.length; a++){
  52.                     if(players[a] == data[i].f3_loss[x]){
  53.                         found = true;
  54.                         break;
  55.                     }
  56.                 }
  57.                 if(!found)
  58.                     console.log('NAME ERROR: Game ' + i + ' f3_loss [' + x + ']');
  59.             }
  60.         }
  61.     }
  62. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement