Help with script servername

LeiToH

Member
Dec 22, 2016
45
16
55
Code:
 Aviso de PHP: uso de la constante indefinida virtualserver_maxclients - asumida 'virtualserver_maxclients' es /root/botname/scripts/clientCountToServername.php en la línea 48
Aviso de PHP: índice no definido: virtualserver_maxclients es /root/botname/scripts/clientCountToServername.php en la línea 48
The Lost - www.the-lost.net | [30128]

Code:
 while ($ xyz == 1) {
#construye un nuevo objeto ts3admin
$ tsAdmin = new ts3admin ($ ts3_ip, $ ts3_queryport);

if ($ tsAdmin-> getElement ('success', $ tsAdmin-> connect ())) {
    #login como serveradmin
    $ tsAdmin-> login ($ ts3_user, $ ts3_pass);

    #select teamspeakserver
    $ tsAdmin-> selectServer ($ ts3_port);

    #get lista de clientes
    $ clients = $ tsAdmin-> clientList ();

        #set Apodo del Bot
        $ tsAdmin-> setName ("Apodo");
        #getting Slots de servidor
        $ serverInfo = $ tsAdmin-> serverInfo ();
        $ maxClients = $ serverInfo ['data'] ['virtualserver_maxclients'];

    #set Apodo de la consulta
    $ tsAdmin-> setName ("Apodo");

    $ allSlots = $ tsAdmin-> serverInfo ();
    echo $ allSlots [virtualserver_maxclients]; // Error de línea 48

    #set Servername
    $ newServerName = "The Lost - www.the-lost.net | [". count ($ clients ['data']). $ maxClients. "]";
    echo $ newServerName;
    $ tsAdmin-> serverEdit (array ('virtualserver_name' => $ newServerName));
}
// cantidad de tiempo para esperar antes de volver a verificar, en segundos.
dormir (30); // Recomendado para no tocar                         
}

can someone help me with this script error
 
Last edited:

kalle

high minded
Contributor
Oct 28, 2015
411
253
178
Hi, I can notice problem here and that is calling to non existing constant.
So to fix this I noticed two lines before working code for getting max slots and that is
PHP:
$ serverInfo = $ tsAdmin-> serverInfo ();
        $ maxClients = $ serverInfo ['data'] ['virtualserver_maxclients'];
And tbh you dont need lines on 47,48. They just print out how much slots are on virtual server. Delete them, and enjoy.
Also notice for future: use syntax highlighting when posting code, and use english for error log posting.
 
Top