16.05.2013, 18:58
(
Last edited by maddinat0r; 02/10/2015 at 09:54 PM.
Reason: v1.3
)
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!Installation
- create a ServerQuery account for your TeamSpeak3 server
NOTE: The ServerQuery account should have enough rights to subscribe to all channels! - add this line to your PAWN script to establish a connection to the TS3 server:
Code:TSC_Connect("serveradmin", "password", "127.0.0.1", 9987); // "serveradmin": the ServerQuery login name // "password": the ServerQuery login password // "127.0.0.1" the TeamSpeak3 server IP // 9987: the TeamSpeak3 server port
- You are ready to go!
Here is a small code example:
pawn Code:
#define TS_SERVER_GROUP_PLAYER 1337
public OnGameModeInit()
{
TSC_Connect("serveradmin", "password", "127.0.0.1", 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;
}
- 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
Notes
- 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 ("127.0.0.1" 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')
Download on GitHub