One Question about the TeamSpeak SDK

Its my first time I´m coding with the TS SDK and I´m trying to make a get a Notification when my friend is joining the Server and its exasperating i dont know how i do that
Can anyone help me pls
~Hallo5000

You don’t need SDK actually.
Use Server Query interface and subscribe to join event and check your friend UID.

I guess you are talking about the Client SDK and not the TeamSpeak SDK (big difference).

So there is a function ts3plugin_onClientMoveMovedEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID moverID, const char* moverName, const char* moverUniqueIdentifier, const char* moveMessage).
This seems counter intuitive as it’s about moving and not joining. But according to the documentation:

[…] If oldChannelID is 0, the client has just connected to the server. If newChannelID is 0, the client disconnected. Both values cannot be 0 at the same time.

@frct1 The question was specifically about the sdk, I see how the query can be an alternative but not all servers even have an accessible query port (I wouldn’t recommend it either). This is a problem that can be solved completely on client side without interacting with the server directly (query) so it should be solved as such.

Thanks now i try this and i hope this is working

1 Like

Another Question is the clientID the same as the IdentityID and how i check if the ID is the right ID ?

The client ID is the temporary ID assigned by the server.

I guess you can use moverUniqueIdentifier because when you “move” yourself / switch channel or connect / disconnect this should be the UUID of the client that joined / left / changed channel.

And how i can take the ID from my friend

We assume the following.

  • You are connected to serverConnectionHandlerID 0
  • Your friend has the UUID abc123==
  • Your friend is named 123abc
  • Your friend connectes to the same server

The following will happen:
TeamSpeak will call #ts3plugin_onClientMoveMovedEvent of every active plugin with the following parameters:

serverConnectionHandlerID = 0
clientID = x
oldChannelID = 0
newChannelID = y
visibility =  ENTER_VISIBILITY
moverID = x
moverName = 123abc
moverUniqueIdentifier = abc123==
moveMessage = z

where x is his temporary ID (in your case not helpful), y is the ID of the channel he joined and z is something like connected to the server (I honestly have no idea about that - it’s not important here)

So you can do the following:

void ts3plugin_onClientMoveMovedEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID moverID, const char* moverName, const char* moverUniqueIdentifier, const char* moveMessage) {
    if(strcmp(moverUniqueIdentifier, "abc123==") == 0) {
        notify();
    }
}

A more sophisticated approach would of course be to not hard code the uuid but have a configuration of some sort.

I dont understand how i become the new clientID everytime my friend join the server

I hope you’ll never become an ID but:

Die Funktion ts3plugin_onClientMoveMovedEvent wird jedes mal aufgerufen, wenn sich irgendjemand in einen fuer dich sichtbaren Channel verbindet. Dabei enthaellt der Aufrauf die clientID und den unique identifier (UUID).
Diese UUID kannst du nutzen um deinen Freund zu identifizieren.

translated by deepl.com

The function ts3plugin_onClientMoveMovedEvent is called every time someone connects to a channel that is visible to you. The call contains the clientID and the unique identifier (UUID).
You can use this UUID to identify your friend.

And where i cant find the UUID the first time …should i ask my friend or something?

In TeamSpeak 3 this is not possible natively afaik. You have to use some information plugin or similar.

This is the most popular one recompiled for the current api version.

This will show all kinds of information on the right hand side.

In TeamSpeak 5 it i salways displayed at the bottom of the client information

1 Like

First thanks for all the help but one question did I have on my IDE there is a ERROR the Object notify(); is unknown How I can notify Users

Yeah this was just an example because you said

So there you can implement your own way of notifying.
I you give me a few minutes I may be able be write something that you poke yourself if you know what I mean.

Yes THANKS

Ok it took me way longer than I expected and I guess I was not perfectly correct above…
You have to use onClientMoveEvent and not onClientMoveMovedEvent - I did not read the docs clear enough to see that.

But here you go:

void ts3plugin_onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage) {
	// check whether the client connected or changed channel
	if (oldChannelID != 0) return;
	
	// just some variables
	char* moverUniqueIdentifier;
	char* moverName;
	anyID me;
	char* uuid = "h2XOnadFt/lGvSOMETHING123="; // replcae this with your friends UUID

	// get the uuid of the connected client
	ts3Functions.getClientVariableAsString(serverConnectionHandlerID, clientID, CLIENT_UNIQUE_IDENTIFIER, &moverUniqueIdentifier);

	// check whether the client is the correct one
	if (strcmp(moverUniqueIdentifier, uuid) != 0) { ts3Functions.freeMemory(moverUniqueIdentifier); return; }
	
	// all tests passed => friend connected
	// get friends name
	ts3Functions.getClientVariableAsString(serverConnectionHandlerID, clientID, CLIENT_NICKNAME, &moverName);
	// get own ID to poke
	ts3Functions.getClientID(serverConnectionHandlerID, &me);

	// build message for poke
	char msg[265] = "Yoo, the man, ";
	strcat_s(msg, sizeof(msg), moverName);
	strcat_s(msg, sizeof(msg), ", is here!");

	// send the poke
	ts3Functions.requestClientPoke(serverConnectionHandlerID, me, msg, NULL);

	// cleanup
	ts3Functions.freeMemory(moverUniqueIdentifier);
	ts3Functions.freeMemory(moverName);
	free(msg);
}

Hit me up if it doesn’t work as expected.

I have a bad news for you when my friend joins the Server my TeamSpeak instantly crash. :C

What is wrong and how it is right

@davinciTS
Even though your answer disappeared by now I have to agree I feel like that’s the problem

Found it I guess.
Remove the last line free(msg);.
And change the sizeof(msg) in both strcpy_s to sizeof(msg) -1

Now the plugin didnt crash but i dont have the Permission: i_client_needed_poke_power but normally i can poke