SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Thread Tools Display Modes
Old 16/05/2013, 07:58 PM   #1
maddinat0r's Avatar
Join Date: Jun 2010
Location: Germany
Posts: 895
Reputation: 482
Default Teamspeak Connector

TeamSpeak Connector v1.3

The TSConnector plugin gives you the possibility to control a TeamSpeak3 server from within your gamemode. That means you can kick or ban users, create, edit and delete channels and more!

  1. create a ServerQuery account for your TeamSpeak3 server
    NOTE: The ServerQuery account should have enough rights to subscribe to all channels!
  2. add this line to your PAWN script to establish a connection to the TS3 server:
    TSC_Connect("serveradmin", "password", "", 9987);
    //  "serveradmin": the ServerQuery login name
    //  "password": the ServerQuery login password
    //  "" the TeamSpeak3 server IP
    //  9987: the TeamSpeak3 server port
    The call to TSC_Connect will freeze the server as long as a valid connection has been established.
  3. You are ready to go!
If you are done using the plugin (e.g. in "OnGameModeExit"), call TSC_Disconnect to disconnect from the TeamSpeak3 server.

Here is a small code example:
pawn Code:

public OnGameModeInit()
    TSC_Connect("serveradmin", "password", "", 9987);
    TSC_ChangeNickname("SA:MP Server");
    TSC_CreateChannel("Channel 1", .type = SEMI_PERMANENT, .maxusers = 25);
    return 1;

public TSC_OnChannelCreated(channelid)
    new channel_name[32];
    TSC_GetChannelName(channelid, channel_name);
    if(strcmp("Channel 1", channel_name) == 0)
        TSC_SetChannelDescription(channelid, "Description of Channel 1!");
    return 1;

public TSC_OnClientConnect(clientid, nickname[])
    TSC_PokeClient(clientid, "Welcome!");
    TSC_AddClientToServerGroup(clientid, TS_SERVER_GROUP_PLAYER);
    return 1;
Some more ideas:
  • moving a player automatically to the right faction channel when going on-duty
  • kicking annoying people from the SA:MP server AND TS3 server
  • ingame proximity-voicechat by creating a channel if two players are in range and moving them into that channel
A list of all functions can be found in the include file.

  • like noted above, make sure the ServerQuery account has enough rights to subscribe to all channels
  • there is an inbuilt ServerQuery flood protection in the TS3 server, make sure the IP you are connecting from (the SA:MP server address) is on the ServerQuery whitelist ("" is by default on that list)
  • make sure the TS3 server listens to incoming query connections (you can change that in your 'ts3server.ini' file with the 'query_ip' variable)
  • the plugin is fully threaded, thus no major lags can occur (except through 'TSC_Connect')

Source on GitHub
Download on GitHub

Last edited by maddinat0r; 02/10/2015 at 10:54 PM. Reason: v1.3
maddinat0r is offline   Reply With Quote
Old 16/05/2013, 08:00 PM   #2
Big Clucker
kadaradam's Avatar
Join Date: Feb 2011
Location: Hungary,Budapest
Posts: 187
Reputation: 65
Default Re: Teamspeak Connector

nice job
kadaradam is offline   Reply With Quote
Old 16/05/2013, 08:09 PM   #3
Big Clucker
ANTH1's Avatar
Join Date: Jul 2010
Posts: 130
Reputation: 4
Default Re: Teamspeak Connector

Sounds like useful! Gonna try it
Good job
ANTH1 is offline   Reply With Quote
Old 16/05/2013, 08:13 PM   #4
Edvin's Avatar
Join Date: Dec 2010
Posts: 867
Reputation: 71
Default Re: Teamspeak Connector

Aw, this is very nice release
Edvin is offline   Reply With Quote
Old 16/05/2013, 08:17 PM   #5
Kyle's Avatar
Join Date: Mar 2009
Location: United Kingdom
Posts: 2,387
Reputation: 319
Default Re: Teamspeak Connector

Nice one pain, is there a way to play the audio into the server?
Kyle is offline   Reply With Quote
Old 16/05/2013, 08:22 PM   #6
maddinat0r's Avatar
Join Date: Jun 2010
Location: Germany
Posts: 895
Reputation: 482
Default AW: Teamspeak Connector

Uh, no, it's not possible. What would you do anyway if you had the voices in the server?
maddinat0r is offline   Reply With Quote
Old 16/05/2013, 08:22 PM   #7
JustBored's Avatar
Join Date: Jan 2013
Location: Buenos Aires - Argentina
Posts: 1,165
Reputation: 134
Default Respuesta: Teamspeak Connector

This is awesome. Good job!
"Compiler - A program designed to tell you how wrong you are. It's a great way to induce stress and frustration."

JustBored is offline   Reply With Quote
Old 16/05/2013, 09:29 PM   #8
Big Clucker
OrMisicL's Avatar
Join Date: Mar 2013
Location: Under the bed
Posts: 102
Reputation: 191
Default Re: Teamspeak Connector

Nice job, but i've noticed something, almost in every native you send the command then receive the answer,
so if this plugin gets connected with an external server, it'll lag the local one, since the recv function hangs the server until an answer is received, i know that its only designed to work with local servers so there is no such a problem

my suggestion is that if you run the Receive function on a seperated thread, and everytime a response is received you check for errors and use a callback to pass it to scripts, something like "TSC_OnError" maybe ?

apart that good work
OrMisicL is online now   Reply With Quote
Old 16/05/2013, 09:35 PM   #9
TheArcher's Avatar
Join Date: Dec 2009
Location: Home
Posts: 2,377
Reputation: 251
Default Re: Teamspeak Connector

Nice, I'll give it a try
TheArcher is offline   Reply With Quote
Old 16/05/2013, 10:48 PM   #10
Kar's Avatar
Join Date: May 2010
Location: Black Asylum
Posts: 3,165
Reputation: 511
Default Re: Teamspeak Connector

Nice! Really, is there any possible way to retrieve messages sent by teamspeak users?
Kar is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Teamspeak P<3TS Everything and Nothing 6 04/08/2012 01:26 AM
[Map] Connector Gas Tellken Maps 4 01/06/2012 04:04 AM
PSU connector help! patchkinson Everything and Nothing 3 20/03/2010 10:24 PM

All times are GMT. The time now is 06:57 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.