Advertisement
Guest User

Untitled

a guest
May 27th, 2018
6,172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Searches and returns the number of matches that had a banned player in them
  3.  *
  4.  * @param   filtered    Whether the search to be filtered or not, false or true
  5.  * @return  int
  6.  */
  7.  
  8. function cMatches(filtered = false) {
  9.     // The number of matches that had cheaters in them
  10.     var nMatches = 0;
  11.    
  12.     // For each game
  13.     $J('.banchecker-withcolumn').each(function(n, target) {
  14.         foundCheater = false;
  15.        
  16.         // Iterate trough all the players
  17.         $J('.banchecker-bans[style]', $J(target)).each(function(x, child) {
  18.             // Get the player's status
  19.             var status = $J(child).attr('style');
  20.            
  21.             if(filtered == true) {
  22.                 var searchType = "red";
  23.             } else {
  24.                 var searchType = "color";
  25.             }
  26.            
  27.             if(status.indexOf(searchType) >= 0) {
  28.                 foundCheater = true;
  29.                 return true;
  30.             }
  31.         });
  32.        
  33.         // If a cheater was found in the match
  34.         if(foundCheater == true) {
  35.             // Increase the number of matches with cheaters in them
  36.             nMatches = nMatches + 1;
  37.         }
  38.     });
  39.    
  40.     return nMatches;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement