Projet

Général

Profil

Révision 63f9678e

ID63f9678e6b8483f94d0bd61fba2bf7fd41661f81
Parent 0469046f
Enfant 563c04a2

Ajouté par Tim Wulkau il y a presque 14 ans

-added queryuser login, -subtract queryclients from usercount

Voir les différences:

plugins/other/teamspeak_user
7 7
#
8 8
# by Tim Wulkau - www.wulkau.de
9 9
#
10
# 18.11.10 - v0.4
11
#            -added queryuser login
12
#	     -subtract queryclients from usercount (tanks to Jakob Lenfers for the idea)
10 13
# 02.10.10 - v0.3
11 14
#            -fixed welcomemessage error
12 15
# 31.01.10 - v0.2
......
25 28
my $port = 10011;              # querryport (default: 10011)
26 29
my @serverids = (1);           # array of virtualserverids (1,2,3,4,...) 
27 30

  
31
my $username = "";	       # only set if the default queryuser hasn?t enough rights (should work without this)
32
my $password = "";
33

  
28 34
# SCRIPT START!
29 35
if(exists $ARGV[0] and $ARGV[0] eq "config")
30 36
{
......
51 57
  {
52 58
    $telnet->cmd("use sid=$server");
53 59
    $telnet->waitfor("/error id=0 msg=ok/");
60
    if($username && $password) {
61
      $telnet->cmd("login $username $password");
62
      $telnet->waitfor("/error id=0 msg=ok/");
63
    }
54 64
    $telnet->cmd("serverinfo");
55 65
    
66
    my $clients = 0;
67
    my $queryclients = 0;
56 68
    my $line = $telnet->getline(Timeout=>5);
57 69
    if ($line =~ m/virtualserver_clientsonline=(\d+) /) {
58
      print "$server.value ".($1-1)."\n";
70
      $clients = $1;
59 71
    }
60
    else {
61
      print "$server.value 0\n";
72
    if ($line =~ m/virtualserver_queryclientsonline=(\d+) /) {
73
      $queryclients = $1;
62 74
    }
63 75
    $telnet->waitfor("/error id=0 msg=ok/");
76
    print "$server.value ".($clients - $queryclients)."\n";
64 77
  }  
65 78
  $telnet->close;
66 79
}

Formats disponibles : Unified diff