Dalexhd

afkchecker.php

Oct 25th, 2017
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <?php
  2. include_once 'include/config.php';
  3. include_once 'include/ts3admin.class.php';
  4.  
  5.  
  6. function afkchecker()
  7. {
  8.     global $query;
  9.     global $config;
  10.     global $clientchannel;
  11.    
  12.     $users = $query->getElement('data',$query->clientList('-groups -voice -away -times -uid'));
  13.    
  14.     foreach ($users as $client)
  15.     {
  16.         $idle = $client['client_idle_time'];
  17.         $time = $config['afkchecker']['afktime'];
  18.         $group = $config['afkchecker']['afkgroup'];
  19.         if($client['client_type'] == 0)
  20.         {
  21.             if($idle>$time*60000 || $client['client_input_muted']==1 || $client['client_output_muted']==1 || $client['client_away']==1)
  22.             {
  23.                 $query->serverGroupAddClient($group, $client['client_database_id']);
  24.                 if($config['afkchecker']['move_afk'])
  25.                 {
  26.                     $clientchannel[$client['client_unique_identifier']] = $client['cid'];
  27.                     $query->clientMove($client['clid'], $config['afkchecker']['afk_channel']);
  28.                 }
  29.             }
  30.             else
  31.             {
  32.                 $query->serverGroupDeleteClient($group, $client['client_database_id']);
  33.                 if($config['afkchecker'])
  34.                 {
  35.                     $query->clientMove($client['clid'], $clientchannel[$client['client_unique_identifier']]);
  36.                     unset($clientchannel[$client['client_unique_identifier']]);
  37.                 }
  38.             }
  39.         }
  40.     }
  41.    
  42.     unset($query);
  43.     unset($config);
  44.     unset($users);
  45.     unset($idle);
  46.     unset($time);
  47.     unset($group);
  48. }
  49.  
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment