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 6 of 6
  1. #1
    Join Date
    May 2014
    Posts
    3

    [DEV] Plugin doesnt load

    Hi,
    im new in Programming TS3 Plugins.
    I used the sdk from my TS3 Folder. I sucessfully Compiled the example plugin and copy it in the plugin folder.
    But... when i now start TS3 the Plugin doesnt load !

    It say allways another API Version like 3026452 ^^

    I Use VC2010 Express .

    I Hope anyone can help me.

    mfg
    Skiron

    ps: sry for my bad bad english

  2. #2
    Join Date
    November 2013
    Posts
    57
    There is no big magic happening

    This is taken from plugin.c

    There is one function in the code, which returns the API version:
    Code:
    // Plugin API version. Must be the same as the clients API major version
    // else the plugin fails to load.
    int ts3plugin_apiVersion() {
        return PLUGIN_API_VERSION;
    }
    The value is defined somewhere at the start of the file:
    Code:
    #define PLUGIN_API_VERSION 20
    Did you change anything of it?

  3. #3
    Join Date
    May 2014
    Posts
    3
    nope but i find it out by myself... i runned a 64bit client and tried to load a 32bit plugin..
    i installed the 32bit client and now it runns...
    i just have a problem with a timer at disabling the plugin.

    i tried something like that
    Code:
    DWORD WINAPI Timer(LPVOID lpParam) {
    	char* channeldesc;
    	int x = 0;
    	while ( x != 11 && endthread == 0)
    	{
    		x++;
    
    		if (x == 10 && endthread == 0)
    		{
    			"do something"
    			x = 0;
    		}
    		if ( endthread == 0 )
    		{
    			Sleep(1000);
    		}
    	}
    
      return 0;
    }
    and start the new thread with
    Code:
    CreateThread(0, NULL, Timer, (LPVOID)"Timer", NULL, NULL);
    and try to close it at the shutdown function with
    Code:
    TerminateThread(Timer,NULL);
    but this dont work fine... it closing the complete client with an acess violation error...
    anyone have an idea how to solve it ?

    ps: where do u have the code brakets ? ^^ in the full reply view ? ahh i got it xD

  4. #4
    Join Date
    November 2013
    Posts
    57
    You should avoid using TerminateThread(), because you cannot free any allocated resources inside the thread. It will just get forced to end.

    Also, you already use some kind of variable to ensure the thread keeps running: endthread
    If you set it to something other than 0, then the thread will terminate itself, right?

    Perhaps you should search for a basic tutorial on multithreading, because it can get really nasty

  5. #5
    Join Date
    May 2014
    Posts
    3
    if i think right, every plugin runs in his own thread... so i can make a simple while loop with Sleep in it without ts hanging....
    or does i think wrong ? xD

  6. #6
    Join Date
    November 2013
    Posts
    57
    if you dont create a thread yourself, then no, it doesnt run in it's own thread.
    It works like this:
    You implement all the functions, which are necessary to have a ts3 plugin (they are listed as such in the sample plugin).
    if you start TS3, it checks for the files in the plugin folder, including your plugin file, whether it's actually a usable plugin (all functions are there and API version is right) or not -> then there is the option to enable and load the plugin.
    If the user chooses to do so, the init function in your plugin gets called and it will also get called the next time you open TS3.
    And if gets disabled or TS3 gets closed the shutdown function gets called.

    You are just offering Teamspeak a way to communicate with you.
    And all the other functions which are defined in the sample plugin and marked as "extern" in plugin.h are also just ways for Teamspeak to tell you that something happened.
    If an event occurs (for example someone starts talking) Teamspeak will go through all loaded plugins (including yours) and tell them about it.

    And if you (as the plugin) want to interact with Teamspeak (for example send a private message), you can use the function pointer Teamspeak gave to you during the loading process.
    This is one of the neccessary functions in the plugin (copy & pasted from the sample plugin):
    Code:
    void ts3plugin_setFunctionPointers(const struct TS3Functions funcs) {
       ts3Functions = funcs;
    }
    By doing that you can use
    Code:
    ts3Functions.requestSendPrivateTextMsg(....);
    to send a private message.

    So there is no automatic thread your plugin is running in. The coding you do and the execution of it is always some kind of reaction to an event and TS3 telling you about it = calling the function for it.

    Of course, if you really want to have your own thread you can create one in the init function and make sure that everything is cleaned up in the shutdown function.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Cant load any plugin
    By ENG_MAC7 in forum Client Plugins / Lua Scripts
    Replies: 1
    Last Post: December 7th, 2014, 04:59 PM
  2. Plugin failed to load
    By Cruz3R in forum Client Plugins / Lua Scripts
    Replies: 1
    Last Post: July 6th, 2014, 12:20 PM
  3. Creating my first TS3 plugin and it won't load
    By DrPastah in forum Client Plugins / Lua Scripts
    Replies: 5
    Last Post: March 12th, 2014, 12:14 PM
  4. Help, unable to load db plugin lib !
    By abt-network in forum Linux / FreeBSD
    Replies: 4
    Last Post: December 19th, 2010, 07:32 PM

Posting Permissions

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