DalexHDYT
Member
- Aug 31, 2016
- 12
- 14
- 38
Hi TS3 programmers community
I´m making a project that allows to X user of the server to interact, on the private chat, with a bot.
The system that I have on my mind is the following one:
(The following code is an example xddd)
The most important part of the php function that I´m using to make this is the following one:
Do you have any idea of how to make this?
I´m making a project that allows to X user of the server to interact, on the private chat, with a bot.
The system that I have on my mind is the following one:
(The following code is an example xddd)
PHP:
<?php
//Wait for a message event...
If ($message == "!help"){
send_this_message_to_the_client("Don´t worry, I will help you :-)... Tell me what is your problem. 1 or 2");
//Wait for answer
if ($problem == "1"){
send_this_message_to_the_client("Your problem is 1 :-)... Tell me what is your sex. man or girl");
//Wait for answer
if ($sex == "man"){
send_this_message_to_the_client("You are a man :-)...");
}elseif($sex == "girl"){
send_this_message_to_the_client("You are a girl :-)...");
}
}elseif ($problem == "2") {
send_this_message_to_the_client("Your problem is 2 :-)... Tell me what do you like. mans or girls");
//Wait for answer
if ($like == "mans"){
send_this_message_to_the_client("You like mans :-)...");
}elseif ($like == "girls"){
send_this_message_to_the_client("You like girls :-)...");
}
}
}
?>
The most important part of the php function that I´m using to make this is the following one:
PHP:
function onTextmessage(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host)
{
global $ts3_VirtualServer;
$type = $event->getType();
$data = $event->getData();
$server = $host->serverGetSelected();
$date = date("Y-m-d H:i:s");
$client_data = array(
'response' => array(
'event' => "onTextmessage",
'type' => null,
'date' => $date,
'data' => array(
'targetmode' => $data['targetmode'],
'msg' => $data['msg'],
'target' => $data['target'],
'clid' => $data['invokerid'],
'client_nickname' => $data['invokername'],
'client_unique_identifier' => $data['invokeruid']
)));
$json = json_encode($client_data);
}