This project has moved. For the latest updates, please go here.

Send Global Message

This Sends a text message to all clients on all virtual servers in the TeamSpeak 3 Server instance.

Parameters:

message: the message to send

Example Usage VB.net

Imports TS3QueryLib.Core
Imports TS3QueryLib.Core.Query
Imports TS3QueryLib.Core.Query.Responses
Imports System
...
Dim targetHost As String = "127.0.0.1"
Dim targetQueryPort As UShort = 10011
Dim login As String = "serveradmin"
Dim password As String = "ANicePassword"
Using queryRunner As New QueryRunner(New SyncTcpDispatcher(targetHost, targetQueryPort))
            Dim loginResponse As SimpleResponse = queryRunner.Login(login, password)
            If loginResponse.IsErroneous Then
                MsgBox("There was An Error")
            Else
                Dim GlobalMessage As SimpleResponse = queryRunner.SendGlobalMessage(globalmessagetxt.Text.ToString())
                If Not GlobalMessage.IsErroneous Then
                      MsgBox("Message Sent to All Servers!")
                Else
                      MsgBox("There was an Error!")
                End If
            End If
        End Using

Example Usage C#

Using TS3QueryLib.Core;
Using TS3QueryLib.Core.Query;
Using TS3QueryLib.Core.Query.Responses;
Using System;
...
string targetHost = "127.0.0.1";
ushort targetQueryPort = 10011;
string login = "serveradmin";
string password = "ANicePassword";
using (QueryRunner queryRunner = new QueryRunner(new SyncTcpDispatcher(targetHost, targetQueryPort))) {
	SimpleResponse loginResponse = queryRunner.Login(login, password);
	if (loginResponse.IsErroneous) {
		Interaction.MsgBox("There was An Error");
	} else {
		SimpleResponse GlobalMessage = queryRunner.SendGlobalMessage(globalmessagetxt.Text.ToString());
		if (!GlobalMessage.IsErroneous) {
			Interaction.MsgBox("Message Sent to All Servers!");
		} else {
			Interaction.MsgBox("There was an Error!");
		}
	}
}

Last edited Jul 3, 2011 at 10:36 AM by JoshuaK456, version 2

Comments

No comments yet.