Dalexhd

commander.php

Oct 25th, 2017
404
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.87 KB | None | 0 0
  1. <?php
  2. include_once 'include/config.php';
  3. include_once 'include/ts3admin.class.php';
  4. function commander()
  5. {
  6.     global $query;
  7.     global $config;
  8.     $channels = $query->getElement('data', $query->channelList("-topic"));
  9.     foreach($channels as $channel)
  10.     {
  11.         if($channel['channel_topic'] == 'commander')
  12.         {
  13.             $wiadomosci = $query->readChatMessage('textchannel', false, $channel['cid']);
  14.             if(isset($wiadomosci['success']) && strlen($wiadomosci['data']['msg']) > 2)
  15.             {
  16.                 if($wiadomosci['success'] == 1)
  17.                 {
  18.                     if($wiadomosci['data']['msg']{0} == '!')
  19.                     {
  20.                         $wpisana_komenda = substr($wiadomosci['data']['msg'], 1);
  21.                         $command_arguments = explode(" ", $wpisana_komenda);
  22.  
  23.                         $user = $query->getElement('data', $query->clientInfo($wiadomosci['data']['invokerid']));
  24.                         $groups = explode(",", $user['client_servergroups']);
  25.  
  26.                         $client['client_nickname'] = $wiadomosci['data']['invokername'];
  27.                         $client['client_uid'] = $wiadomosci['data']['invokeruid'];
  28.                         $client['client_clid'] = $wiadomosci['data']['invokerid'];
  29.                         $client['client_cmd'] = $command_arguments[0];
  30.                         $client['client_params'] = $wpisana_komenda;
  31.  
  32.                         for($i=0; $i<count($config['commander']['commands_list']); $i++)
  33.                         {
  34.                             if($client['client_cmd'] == $config['commander']['commands_list'][$i])
  35.                             {
  36.                                 if(isInGroup($groups, $config['commander']['commands'][$config['commander']['commands_list'][$i]]['allowed_groups']))
  37.                                 {
  38.                                     echo 'Użytkownik '.$client['client_nickname'].' (clid: '.$client['client_clid'].') wywołał komendę: '.$client['client_cmd'].'' . PHP_EOL;
  39.                                     $funkcja = $wpisana_komenda;
  40.                                     $funkcja($client['client_clid'], $client['client_uid'], $client['client_nickname'], $client['client_params']);
  41.                                     break;
  42.                                 }
  43.                             }
  44.                         }
  45.                     }
  46.                 }
  47.             }
  48.         }
  49.     }
  50.     unset($query);
  51.     unset($config);
  52. }
  53. ?>
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment