One Question about the TeamSpeak SDK

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

I see:

const char* msg = ("Yoo, the man, " + std::string(moverName) + ", is here!").c_str();

What is important here is:
const char* msg = (x).c_str(); You can change everything but x.
If you just want one hardcoded message replace x with the message like so:
const char* msg = ("The message goes here.").c_str();
If you want the message to contain his name e.g. Do it like in the example above.

Without getting too into the weeds, be careful with c_str() on temporary objects !

1 Like

It gives me a error (Microsoft Visual Studios Code: C2224) I dont know how to solve this problem

I think I know the problem (exactly what davinci said).
Can you share your code so I can have a look at it?

This is only the Test Plugin of the SDK and ive changed the name and description and put your code in

Have you renamed the file to plugin.cpp and added #include <string>?

I dont know wich file you mean

plugin.c

ive changed it to plugin.cpp and there still a error

You gotta tell me what the error is

I cant translate that in english

You expect me to be able to help you resolve an error without knowing the error?

Okay here the error but in German: Links von “.c_str” müssen sich in einer Klasse/Struktur/Union befinden

Ok, perfect
so I guess you code is like I said above
const char* msg = ("The message goes here.").c_str();
But I think this has a problem with types so
const char* msg = std::string("The message goes here.").c_str();
should work.