SHARE
TWEET

Untitled

a guest Feb 14th, 2020 19 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ss = SpreadsheetApp.getActiveSpreadsheet();
  2. var serverlist_sheet = ss.getSheetByName('Player List')
  3. var real_array = [[7, 8, 9], [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75], [79]]
  4. //var player_name_roster = [7, 8, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 79, 80, 81, 82, 83]
  5. var days_array = [12, 6, 7, 8, 9, 10, 11];
  6.  
  7.  
  8. var add_minutes = function(dt, minutes) {
  9.   try{
  10.     return new Date(dt.getTime() + minutes * 60000);
  11.   }
  12.   catch(err){
  13.     return new Date()
  14.     }
  15. }
  16.  
  17. function checkLOAs() {
  18.  
  19.   for (var l = 0 ; l <= real_array.length - 1 ; l++){
  20.     var date = new Date()
  21.     var sheet = ss.getSheetByName("Personnel Roster")
  22.     var range = sheet.getRange(real_array[l][0], 3, real_array[l][real_array[l].length - 1] - real_array[l][0] + 1, 2)
  23.     Logger.log(range)
  24.     var values = range.getValues()
  25.     Logger.log(values)
  26.     for (var i = 0; i <= real_array[l].length - 1; i++) {
  27.       Logger.log(values[i])
  28.       Logger.log(i)
  29.         var dateToCheck = values[i][1]
  30.         if (dateToCheck <= date && typeof dateToCheck != "string") {
  31.             Logger.log(sheet.getRange(real_array[l][i], 4).getValue())
  32.             sheet.getRange(real_array[l][i], 4).setValue("")
  33.         }
  34.     }
  35.   }
  36. }
  37.  
  38.  
  39. function getData() {
  40.     var queryString = Math.random();
  41.     var sheet = ss.getSheetByName("Player List")
  42.  
  43.     var cellFunction1 = '=CLEAN(IMPORTXML("' + serverlist_sheet.getRange('B1').getValue() + '?' + queryString + '","' + serverlist_sheet.getRange('B2').getValue() + '"))';
  44.     serverlist_sheet.getRange('C1').setValue(cellFunction1);
  45. }
  46.  
  47.  
  48.  
  49. function checkplayer() {
  50.  
  51.  
  52.   for (var l = 0 ; l <= real_array.length - 1 ; l++){
  53.  
  54.     var rank_sheet = ss.getSheetByName("Activity Manager");
  55.     var playersheet = ss.getSheetByName("Player List");
  56.     var day = days_array[new Date().getDay()]
  57.     var onlinerange = playersheet.getRange(2, 3, 128)
  58.     var onlineValues = onlinerange.getValues()
  59.     var range = rank_sheet.getRange(real_array[l][0] - 1, 5, real_array[l][real_array[l].length - 1] - real_array[l][0] + 1)
  60.     var values = range.getValues()
  61.     Logger.log(values)
  62.    
  63.     for (var i = 0; i <= onlineValues.length - 1; i++) {
  64.         var steamIDToTest = onlineValues[i][0]
  65.         if (steamIDToTest == "") {
  66.             continue
  67.         }
  68.         for (var j = 0; j <= real_array[l].length - 1; j++) {
  69.          
  70.          
  71.             var steamID = values[j][0]
  72.             Logger.log(steamID)
  73.             if (steamID == "") {
  74.                 continue
  75.             } else if (steamIDToTest == steamID) {
  76.               Logger.log(real_array[l][j] - 1)
  77.                 var timeToEdit = rank_sheet.getRange(real_array[l][j] - 1, day)
  78.                
  79.               //  Logger.log(steamIDToTest)
  80.               //  Logger.log(real_array[l][j])
  81.                var time = timeToEdit.getValue()
  82.                 timeToEdit.setValue(add_minutes(time, 5))
  83.  
  84.             }
  85.         }}
  86.     }
  87.  
  88. }
  89.  
  90.  
  91. function resetTime() {
  92.     var sheet = ss.getSheetByName("Activity Manager")
  93.     real_array.forEach(function(rangeToReset){
  94.       sheet.getRange(rangeToReset[0] - 1, 6, rangeToReset.length, 7).setValue("00:00")
  95.     })
  96. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top