PsyOps

FlagTimer

May 18th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.74 KB | None | 0 0
  1.     private boolean m_FlagTimerON = false;
  2.     private long TS_FlagTimer = System.currentTimeMillis();
  3.     private int Delay_FlagTimer = 90;//seconds
  4.     private boolean[] m_FlagTimerNotificationsChecks = new boolean[]{ false, false, false, false, false, false };
  5.     private int[] m_FlagTimerNotificationsTimes = new int[]{ 30, 5, 4, 3, 2, 1 };
  6.     private String[] m_FlagTimerNotifications = new String[]{"30 Seconds!"," - 5 - "," - 4 - "," - 3 - "," - 2 - "," - 1 - "};
  7.     private int[] m_FlagTimerSoundCodes = new int[]{ 0, 26, 26, 26, 26, 26};
  8.     private boolean m_InitialAnnounceSent = false;
  9.     private String m_InitialAnnounce = "T20 BaseAttack starting in 1m 30s ! Hop in to join the fun.";
  10.     private int m_InitialAnnounceSoundCode = 4;
  11.     private String m_TimerEndAnnounce = "GO GO GO - Defend T20!.";
  12.     private int m_TimerEndSoundCode = 104;
  13.     private void baseGameFlagTimer()
  14.     {
  15.         if (!m_FlagTimerON) return;
  16.         if (!m_InitialAnnounceSent)
  17.         {
  18.             m_InitialAnnounceSent = true;
  19.             b.sendArenaMessage(m_InitialAnnounce,m_InitialAnnounceSoundCode);
  20.             return;
  21.         }
  22.        
  23.         long elapsed = System.currentTimeMillis() - TS_FlagTimer;
  24.        
  25.         for (int i = 0; i < m_FlagTimerNotificationsChecks.length; i+=1)
  26.         {
  27.             if (!m_FlagTimerNotificationsChecks[i] && (Delay_FlagTimer * 1000) - elapsed <= (m_FlagTimerNotificationsTimes[i]*1000))
  28.             {
  29.                 int secs = m_FlagTimerNotificationsTimes[i];
  30.                 m_FlagTimerNotificationsChecks[i] = true;
  31.                 b.sendArenaMessage(m_FlagTimerNotifications[i],m_FlagTimerSoundCodes[i]);
  32.             }
  33.         }
  34.        
  35.         if (elapsed > (Delay_FlagTimer *1000))
  36.         {
  37.             m_FlagTimerON = false;
  38.             TS_FlagTimer = System.currentTimeMillis();
  39.             m_InitialAnnounceSent = false;
  40.             b.sendArenaMessage(m_TimerEndAnnounce,m_TimerEndSoundCode);
  41.             m_BGameOn = true;
  42.         }
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment