One Question about the TeamSpeak SDK

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

Can you check your right click menu -> permissions -> permission overview for poke and needed poke power?

No on this server i cant check the permissions

I found no easy way to prevent this / notify you in another way.
So I faked a poke by simply playing the poke sound - not sure whether this is actually the way to do this (it worked for me) and printed the message to the current tab (so there is no pop up)

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
	const char* msg = ("Yoo, the man, " + std::string(moverName) + ", is here!").c_str();

	// send the poke
	//ts3Functions.requestClientPoke(serverConnectionHandlerID, me, msg, NULL);
	ts3Functions.printMessageToCurrentTab(msg);
	
	// play poke sound
	char appPath[PATH_BUFSIZE];
	ts3Functions.getAppPath(appPath, PATH_BUFSIZE);
	printf("%s\n", appPath);
	strcat_s(appPath, PATH_BUFSIZE-1, "sound/default/you_were_poked.wav");
	ts3Functions.playWaveFile(serverConnectionHandlerID, appPath);

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

This currently uses cpp to make the build message part better. You can either use this or the old one.
If you want to use this new cpp way you have to

  • rename plugin.c to plugin.cpp and
  • add #include <string> at the top to all the other includes.
1 Like

I have an Idea I hardcode the message because i know that i have this only for one user. But can you say me how i do that beacause iam a beginner in c++

What is currently the problem?
My last version should work just fine.
Here the full plugin.cpp file:

I hope i make no errors because my englsh is not the best and than iam trying the easiest way and your version is not the easiest i think i cant hardcode the message