[Script] Create Your own commands with php

riksha

Member
Sep 13, 2015
11
2
38
What exactly is this problem ?
I have PHP installed on my server.

ojJpedb.png
 

Reconbla

Member
Feb 17, 2016
19
1
35
Hello can you do something with rank permission please bro
Like if new client = 0 rank
12 Hours client = 1 rank

and it's UP auto like this
 

DDoSBoy

Member
May 11, 2016
58
22
56
hello
i saw a bots on one of the servers , Function bot is when anyone enter channel for game ranks he can select his games by typing on the channel chat numbers . example : i wanna get a rank for Minecraft game and agario i just type in the channel number 1 and i will get minecraft , number 2 i'll get agario rank . it's look like commands .

Anyone can help me to get this bot ?
and thanks =)
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
@sa7er The source you can find in the first post of this thread can be used to achieve exactly what you want.
 

MahmouD

Member
Feb 11, 2016
77
5
56
PHP:
<?php
require_once("TeamSpeak3/TeamSpeak3.php");

//--------INFO------------//
$login_name = 'serveradmin';
$login_password ='';
$ip = '127.0.0.1';
$query_port = '10011';
$virtualserver_port = '9987';
$bot_name = 'TS3hASVANBot';
$ts3helpchannel = "94";
//--------INFO------------//

$ts3_VirtualServer = TeamSpeak3::factory("serverquery://".$login_name.":".$login_password."@".$ip.":".$query_port."/?server_port=".$virtualserver_port."&nickname=TEST&blocking=0");

$ts3botid = $ts3_VirtualServer->whoamiGet('client_id');
$ts3_VirtualServer->clientMove($ts3botid, $ts3helpchannel);

$arr_ClientList = $ts3_VirtualServer->clientList(array("client_platform" => "ServerQuery"));

foreach($arr_ClientList as $ts3_Client)
{
    if($ts3_Client['client_nickname'] == $bot_name)
    {
        $ts3_VirtualServer->request("quit");
        exit;
    }
}
$ts3_VirtualServer->selfUpdate(array("client_nickname" => $bot_name));

TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryWaitTimeout", "onWaitTimeout");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyTextmessage", "onTextMessage");

$ts3_VirtualServer->notifyRegister("server");
$ts3_VirtualServer->notifyRegister("channel");
$ts3_VirtualServer->notifyRegister("textserver");
$ts3_VirtualServer->notifyRegister("textchannel");
$ts3_VirtualServer->notifyRegister("textprivate");


while(1)
{
    $ts3_VirtualServer->getAdapter()->wait();
}

function onWaitTimeout($time, TeamSpeak3_Adapter_Abstract $adapter)
{
    if($adapter->getQueryLastTimestamp() < time()-300)
    {
        $adapter->request('clientupdate');
    }
}

function onTextMessage(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host) {

    $info = $event->getData();
    $srv = $host->serverGetSelected();
    if($info["targetmode"] == 2)
    {
          $mystring = $info["msg"];
          $pos1 = strpos($mystring, " ");
          if($pos1 > 0){
          $var = substr($mystring, 0, $pos1);
          }else{
          $var = $mystring;
          }     
          if($var == "!say"){         
            $srv->message("".str_replace('!say ', '', "[b][color=green]".$info["msg"]."[/color][/b]")."");               
          }elseif($var == "!kick"){
            $client = str_replace('!kick ', '', $info["msg"]);
            foreach($srv->clientList() as $ts3_Client)
            {
                  if($client == $ts3_Client)
                  {
                     $srv->clientGetByName("".$client."")->kick(TeamSpeak3::KICK_SERVER, "");
                  }else{
                    $srv->clientGetByName($info["invokername"]->toString())->message("User Not found");
                  }
            }                   
          }else{
             $srv->clientGetByName($info["invokername"]->toString())->message("Command Not found");
          }
    }
           
   


}
?>
Example:
3jTJtDU.png
@hASVAN I want this script to give rank in the server group by typing cmds in the chat. example : if i type in the chat number 1 i will get League of Legend rank.. and the maximum ranks is 4 of 20 .. and if he typed number 1 again the rank will be removed
 

DDoSBoy

Member
May 11, 2016
58
22
56
PHP:
<?php
require_once("TeamSpeak3/TeamSpeak3.php");

//--------INFO------------//
$login_name = 'serveradmin';
$login_password ='';
$ip = '127.0.0.1';
$query_port = '10011';
$virtualserver_port = '9987';
$bot_name = 'TS3hASVANBot';
$ts3helpchannel = "94";
//--------INFO------------//

$ts3_VirtualServer = TeamSpeak3::factory("serverquery://".$login_name.":".$login_password."@".$ip.":".$query_port."/?server_port=".$virtualserver_port."&nickname=TEST&blocking=0");

$ts3botid = $ts3_VirtualServer->whoamiGet('client_id');
$ts3_VirtualServer->clientMove($ts3botid, $ts3helpchannel);

$arr_ClientList = $ts3_VirtualServer->clientList(array("client_platform" => "ServerQuery"));

foreach($arr_ClientList as $ts3_Client)
{
    if($ts3_Client['client_nickname'] == $bot_name)
    {
        $ts3_VirtualServer->request("quit");
        exit;
    }
}
$ts3_VirtualServer->selfUpdate(array("client_nickname" => $bot_name));

TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryWaitTimeout", "onWaitTimeout");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyTextmessage", "onTextMessage");

$ts3_VirtualServer->notifyRegister("server");
$ts3_VirtualServer->notifyRegister("channel");
$ts3_VirtualServer->notifyRegister("textserver");
$ts3_VirtualServer->notifyRegister("textchannel");
$ts3_VirtualServer->notifyRegister("textprivate");


while(1)
{
    $ts3_VirtualServer->getAdapter()->wait();
}

function onWaitTimeout($time, TeamSpeak3_Adapter_Abstract $adapter)
{
    if($adapter->getQueryLastTimestamp() < time()-300)
    {
        $adapter->request('clientupdate');
    }
}

function onTextMessage(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host) {

    $info = $event->getData();
    $srv = $host->serverGetSelected();
    if($info["targetmode"] == 2)
    {
          $mystring = $info["msg"];
          $pos1 = strpos($mystring, " ");
          if($pos1 > 0){
          $var = substr($mystring, 0, $pos1);
          }else{
          $var = $mystring;
          }     
          if($var == "!say"){         
            $srv->message("".str_replace('!say ', '', "[b][color=green]".$info["msg"]."[/color][/b]")."");               
          }elseif($var == "!kick"){
            $client = str_replace('!kick ', '', $info["msg"]);
            foreach($srv->clientList() as $ts3_Client)
            {
                  if($client == $ts3_Client)
                  {
                     $srv->clientGetByName("".$client."")->kick(TeamSpeak3::KICK_SERVER, "");
                  }else{
                    $srv->clientGetByName($info["invokername"]->toString())->message("User Not found");
                  }
            }                   
          }else{
             $srv->clientGetByName($info["invokername"]->toString())->message("Command Not found");
          }
    }
           
   


}
?>
Example:
3jTJtDU.png


I need the script work for Ever No EXIT ! How ! i need him Bot.sh <<<
 

hASVAN

Active Member
Jun 7, 2015
76
40
93
@hASVAN I want this script to give rank in the server group by typing cmds in the chat. example : if i type in the chat number 1 i will get League of Legend rank.. and the maximum ranks is 4 of 20 .. and if he typed number 1 again the rank will be removed
can you pm me with skype or discord or teamspeak so i can speak with you?
im guys really busy now i will try to help you guys soon.. 3 days max pm me in priv message and i will try to help you
 

techgolem

Member
Jan 12, 2016
38
12
50
Is it possible that this script sends every guest a message and that the users are able to use a command like !accept to get a servergroup?
 

techgolem

Member
Jan 12, 2016
38
12
50
I tried it already, but i dont know how I can set a welcome message just for a special group and make the command just available for this group..

I need the script work for Ever No EXIT ! How ! i need him Bot.sh <<<
i don't tried it, but it should work:
#!/bin/bash
if [ $1 = 'stop' ]
then
screen -X -S php_script exit
echo "Script sucessfully stopped!"
fi

if [ $1 = 'start' ]
then
screen -A -m -d -S php_script php script.php
echo "Script sucessfully started!"
fi
 
Last edited:

vupyC

Member
Mar 2, 2016
29
0
36
Parse error: syntax error, unexpected T_PUBLIC in Z:\home\localhost\www\tes\TeamSpeak3\Node\Client.php on line 2
 
Top