Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 13 of 13
  1. #1
    Join Date
    February 2014
    Posts
    24

    Help with plugin.

    I have a plugin that when a user joins a specified channel it gets the clients of a specific server group and notifies them.

    Code:
    void ts3plugin_onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage) {
    	if(newChannelID==198) {
    	 //Get a list of clients in the specified server group.
    	ts3Functions.requestServerGroupClientList(serverConnectionHandlerID, 39, 1, NULL);
    	}
    }
    
    void ts3plugin_onServerGroupClientListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* clientNameIdentifier, const char* clientUniqueID) {
    	ts3Functions.requestClientIDs(serverConnectionHandlerID, clientUniqueID, NULL);
    }
    
    void ts3plugin_onClientIDsEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, anyID clientID, const char* clientName) {
    	ts3Functions.requestClientPoke(serverConnectionHandlerID, clientID, "Test Message", NULL);
    }
    im trying to figure out how to make it check if the user that joins the channel is a part of a set server group(s) that are set to not trigger the notification. I also need it to only send one message if multiple people join at the same time.

    ive been trying to find info on this for the past couple of days and have came up with nothing.

    Thanks.
    Last edited by Tylerjet; June 9th, 2014 at 05:29 AM.

  2. #2
    Join Date
    February 2014
    Posts
    24
    Could i at least get a confirmation or denial that it is even possible so i can know if i should just stop trying to make it work.

  3. #3
    Join Date
    November 2013
    Posts
    57
    all those servergroup functions are not really mentioned in the ClientLib SDK, but I found this one here in the public_rare_definitions.h:

    Code:
    enum ClientPropertiesRare {
    ...
    CLIENT_SERVERGROUPS,     //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds all servergroups client belongs too
    ...
    }
    so perhaps you can do something like this in your "client move" event instead of requesting the whole list etc.:
    Code:
    int result;
    int err = ts3Functions.getClientVariableAsInt(serverConnectionHandlerID, clientID, CLIENT_SERVERGROUPS, &result);
    I'm not really sure what the result will be, if you are in multiple servergroups.


    For your second question: "only one notification"
    You will get multiple events, if multiple people join a channel. There is no way around that.
    Here is what you can do (just an idea):
    Save the time if someone joins your channel in e.g. "lastjoin".
    Everytime someone joins your channel, compare the current time to the saved one in "lastjoin".
    If the difference is more than x seconds, then do a new notification and save the current time as "lastjoin"
    If not, then ignore the event and do nothing.

  4. #4
    Join Date
    February 2014
    Posts
    24
    Quote Originally Posted by Goreki View Post
    all those servergroup functions are not really mentioned in the ClientLib SDK, but I found this one here in the public_rare_definitions.h:

    Code:
    enum ClientPropertiesRare {
    ...
    CLIENT_SERVERGROUPS,     //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds all servergroups client belongs too
    ...
    }
    so perhaps you can do something like this in your "client move" event instead of requesting the whole list etc.:
    Code:
    int result;
    int err = ts3Functions.getClientVariableAsInt(serverConnectionHandlerID, clientID, CLIENT_SERVERGROUPS, &result);
    I'm not really sure what the result will be, if you are in multiple servergroups.


    For your second question: "only one notification"
    You will get multiple events, if multiple people join a channel. There is no way around that.
    Here is what you can do (just an idea):
    Save the time if someone joins your channel in e.g. "lastjoin".
    Everytime someone joins your channel, compare the current time to the saved one in "lastjoin".
    If the difference is more than x seconds, then do a new notification and save the current time as "lastjoin"
    If not, then ignore the event and do nothing.
    Thanks ill try it when i get the chance.

  5. #5
    Join Date
    October 2012
    Location
    Germany
    Posts
    553
    Iirc int won't do it, for the very reason of potentionally being in multiple groups.

    That's how I do it.

    Note that since this stuff doesn't really benefit from being done as a plugin, I've also done a lua script where you'd just have to implement messaging (currently it plays a notification sound).

    Lastly, JTS3ServerMod can do this on the server query bot side of things.

  6. #6
    Join Date
    February 2014
    Posts
    24
    Quote Originally Posted by Philosound View Post
    Iirc int won't do it, for the very reason of potentionally being in multiple groups.

    That's how I do it.

    Note that since this stuff doesn't really benefit from being done as a plugin, I've also done a lua script where you'd just have to implement messaging (currently it plays a notification sound).

    Lastly, JTS3ServerMod can do this on the server query bot side of things.
    Yep Just got it working and noticed that it only prints 1 server group instead of all of them.
    and yes i know about jts3 i just cant use it due to no server quarry access.

  7. #7
    Join Date
    September 2012
    Posts
    6,079
    Quote Originally Posted by Goreki View Post
    Code:
    int result;
    int err = ts3Functions.getClientVariableAsInt(serverConnectionHandlerID, clientID, CLIENT_SERVERGROUPS, &result);
    I'm not really sure what the result will be, if you are in multiple servergroups.
    You need to use getClientVariableAsString and it'll return a comma separated list of Servergroup IDs, or just one ID if the client in question is in only one server group.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  8. #8
    Join Date
    February 2014
    Posts
    24
    Quote Originally Posted by Chris View Post
    You need to use getClientVariableAsString and it'll return a comma separated list of Servergroup IDs, or just one ID if the client in question is in only one server group.
    Code:
    char* result;
    		int err = ts3Functions.getClientVariableAsString(serverConnectionHandlerID, clientID, CLIENT_SERVERGROUPS, &result);
    Works Perfectly thanks for the help guys.

    Edit: with getClientVariableAsString i cannot compare the individual server groups it prints out to a set number any way around this?
    Last edited by Tylerjet; June 16th, 2014 at 10:12 PM.

  9. #9
    Join Date
    September 2012
    Posts
    6,079
    Code:
    int searchGroup = 6; // ID of group.
    char* result;
    if (ts3Functions.getClientVariableAsString(serverConnectionHandlerID, clientID, CLIENT_SERVERGROUPS, &result) == ERROR_ok) {
    	QStringList groupsOfClient = QString(result).split(",");
    	ts3Functions.freeMemory(result);
    	if (groupsOfClient.contains(QString::number(searchGroup))) {
    		// This client is in the group you're looking for
    		// do whatever you want to do
    	}
    }
    Also possible with just pure C/C++ but Qt is awesome and makes life easier, so ^^. Plus I'm too lazy to write all the code for the pure C/C++ variant :P
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  10. #10
    Join Date
    February 2014
    Posts
    24
    Quote Originally Posted by Chris View Post
    Code:
    int searchGroup = 6; // ID of group.
    char* result;
    if (ts3Functions.getClientVariableAsString(serverConnectionHandlerID, clientID, CLIENT_SERVERGROUPS, &result) == ERROR_ok) {
    	QStringList groupsOfClient = QString(result).split(",");
    	ts3Functions.freeMemory(result);
    	if (groupsOfClient.contains(QString::number(searchGroup))) {
    		// This client is in the group you're looking for
    		// do whatever you want to do
    	}
    }
    Also possible with just pure C/C++ but Qt is awesome and makes life easier, so ^^. Plus I'm too lazy to write all the code for the pure C/C++ variant :P
    i have never heard of or used qt so how would i go about using it or getting it.

  11. #11
    Join Date
    September 2012
    Posts
    6,079
    Well, like I said you don't have to use it and if you're not using it anywhere else you'd be better off just using the C/C++ variant of the above. You can find information on how to split strings into a list on Google.

    One way:
    Code:
    int searchGroup = 6; // ID of group.
    char* result;
    if (ts3Functions.getClientVariableAsString(serverConnectionHandlerID, clientID, CLIENT_SERVERGROUPS, &result) == ERROR_ok) {
    	std::istringstream buffer(result);
    	std::string grp;
    	ts3Functions.freeMemory(result);
    
    	while (std::getline(buffer, grp, ',')) {
    		if (stoi(grp) == searchGroup) {
    			// User is in group, do what you want
    		}
    	}
    }
    Last edited by Chris; June 18th, 2014 at 09:49 AM. Reason: fixed
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  12. #12
    Join Date
    February 2014
    Posts
    24
    so i added the code and googled how to split strings and i noticed that to use istringstream i need to do #include <sstream>. But when i do i get errors.

    Code:
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'acosf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'asinf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'atanf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'atan2f'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'ceilf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2061: syntax error : identifier 'cosf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2061: syntax error : identifier 'coshf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2061: syntax error : identifier 'expf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2061: syntax error : identifier 'fabsf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2061: syntax error : identifier 'floorf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2061: syntax error : identifier 'fmodf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2061: syntax error : identifier 'frexpf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2061: syntax error : identifier 'ldexpf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2061: syntax error : identifier 'logf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2061: syntax error : identifier 'log10f'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2061: syntax error : identifier 'modff'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2061: syntax error : identifier 'powf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2061: syntax error : identifier 'sinf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2061: syntax error : identifier 'sinhf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2061: syntax error : identifier 'sqrtf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2061: syntax error : identifier 'tanf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2061: syntax error : identifier 'tanhf'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2061: syntax error : identifier 'acosl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2061: syntax error : identifier 'asinl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2061: syntax error : identifier 'atanl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2061: syntax error : identifier 'atan2l'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2061: syntax error : identifier 'ceill'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2061: syntax error : identifier 'cosl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2061: syntax error : identifier 'coshl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2061: syntax error : identifier 'expl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2061: syntax error : identifier 'fabsl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2061: syntax error : identifier 'floorl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2061: syntax error : identifier 'fmodl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2061: syntax error : identifier 'frexpl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2061: syntax error : identifier 'ldexpl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2061: syntax error : identifier 'logl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2061: syntax error : identifier 'log10l'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2061: syntax error : identifier 'modfl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2061: syntax error : identifier 'powl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sinl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sinhl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sqrtl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2061: syntax error : identifier 'tanl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2061: syntax error : identifier 'tanhl'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(37): error C2061: syntax error : identifier 'abs'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(37): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2061: syntax error : identifier 'acos'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2061: syntax error : identifier 'asin'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'atan'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'atan2'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'ceil'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(41): error C2061: syntax error : identifier 'cos'
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(41): fatal error C1003: error count exceeds 100; stopping compilation
    and just in case these are the #includes i have
    Code:
    #include <sstream>
    #include <time.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <assert.h>
    #include "public_errors.h"
    #include "public_errors_rare.h"
    #include "public_definitions.h"
    #include "public_rare_definitions.h"
    #include "ts3_functions.h"
    #include "plugin.h"
    some of this is very new to me so sorry for all the confusion/questions.

  13. #13
    Join Date
    September 2012
    Posts
    6,079
    Google is awesome™.
    You should find that it is due to you trying to compile C++ code as C.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Where are the newest plugin.c and plugin.h files?
    By PatPeter in forum General Questions
    Replies: 5
    Last Post: July 24th, 2015, 12:43 PM
  2. TS3 IPC Plugin - Use the plugin sdk in your external apps
    By Thomas in forum Client Plugins / Lua Scripts
    Replies: 31
    Last Post: June 14th, 2011, 11:02 AM
  3. ts3 overlay plugin (Failed to open plugin)
    By netmario in forum Windows
    Replies: 0
    Last Post: September 22nd, 2010, 09:29 AM
  4. Replies: 0
    Last Post: April 9th, 2010, 01:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •