Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.44 KB | None | 0 0
  1. using TS3QueryLib.Core.Common.Responses;
  2. using TS3QueryLib.Core.Server.Entities;
  3. using TS3QueryLib.Core;
  4. using System.Timers;
  5. using System;
  6.  
  7. namespace MoVeMe
  8. {
  9.     class Program
  10.     {
  11.         public static ListResponse<ClientListEntry> Clients;
  12.         public static TS3QueryLib.Core.Server.QueryRunner Server = new TS3QueryLib.Core.Server.QueryRunner(new SyncTcpDispatcher("qwertyuiop.no-ip.biz", 10011));
  13.         public static System.Threading.Thread GiveGroup = new System.Threading.Thread(new System.Threading.ThreadStart(Steam.GiveGroupFromSteam));
  14.         static void Main(string[] args)
  15.         {
  16.             System.Threading.Thread Message = new System.Threading.Thread(new System.Threading.ThreadStart(RegisterForMessages));
  17.             Message.Start();
  18.  
  19.             Server.Login("serveradmin", "");
  20.             Server.SelectVirtualServerById(1);
  21.             Clients = Server.GetClientList(true);
  22.             GiveGroup.Start();
  23.             Timer Time = new Timer(5000);
  24.             Time.Start();
  25.             Time.Elapsed += new ElapsedEventHandler(Query);
  26.  
  27.             Console.ReadKey();
  28.         }
  29.  
  30.         private static void Query(object source, ElapsedEventArgs e)
  31.         {
  32.            
  33.             try
  34.             {
  35.                 Steam.Manual_Poll();
  36.  
  37.                 foreach (ClientListEntry Client in Clients)
  38.                 {
  39.                     if (!Client.Nickname.StartsWith("server") && !Client.Nickname.StartsWith("Unk"))
  40.                     {
  41.                         if (Client.ClientIdleDuration.GetValueOrDefault().TotalMinutes >= 15)
  42.                         {
  43.                             Console.WriteLine("Moving Client: {0} Reason: Idle", Client.Nickname);
  44.                             Server.MoveClient(Client.ClientId, 4);
  45.                         }
  46.                         if (Client.IsClientAway == true && Client.ClientIdleDuration.GetValueOrDefault().TotalMinutes >= 5)
  47.                         {
  48.                             Console.WriteLine("Moving Client: {0} Reason: Idle & Away", Client.Nickname);
  49.                             Server.MoveClient(Client.ClientId, 4);
  50.                         }
  51.                     }
  52.  
  53.                 }
  54.             }
  55.             catch (Exception E)
  56.             {
  57.                 Console.WriteLine(E.Message);
  58.             }
  59.         }
  60.  
  61.  
  62.         static void RegisterForMessages()
  63.         {
  64.             //while (true)
  65.             {
  66.             }
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement