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

Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27

Thread: Move to Channel

  1. #16
    Join Date
    October 2014
    Posts
    60
    Thank you Philosound.

    I have now ended up with this which works perfectly when I hit the PTT.

    Code:
    void ts3plugin_onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int status, int isReceivedWhisper, anyID clientID) {
    		/*TEST INFO */
    		uint64 channelId = 0;
    		char *chpath[] = {"Air Traffic Control", "Tower", ""}; // Channel Structure
    		// Get the ID from the name
    		if (ts3Functions.getChannelIDFromChannelNames(serverConnectionHandlerID, chpath, &channelId) == ERROR_ok && channelId > 0) {
    			anyID myId = 0;
    			ts3Functions.getClientID(serverConnectionHandlerID, &myId);
    			if (myId > 0)
    				ts3Functions.requestClientMove(serverConnectionHandlerID, myId, channelId, "", NULL);
    			else
    				ts3Functions.printMessageToCurrentTab("We don't have a client ID");
    		} else
    			ts3Functions.printMessageToCurrentTab("Error getting the Channel ID");
    		/* TEST INFO END */
    I have 2 more questions remaining before I can take this code and start to work on the flight sim side of things.

    1. My flight sim code will bring the frequency in the form of Frequency = FREQ.
    Can I now define FREQ somewhere so if channel name = FREQ switch channel, otherwise ignore?

    2.Because I am using onTalkStatusChangeEvent I now have
    <22:14:02> already member of channel
    <22:14:05> already member of channel
    <22:14:06> already member of channel
    <22:14:06> already member of channel
    <22:14:07> already member of channel
    <22:14:08> already member of channel
    <22:14:08> already member of channel

    Everytime I press the PTT.
    Is there a better event I could use which would not cause this to show up?

  2. #17
    Join Date
    September 2012
    Posts
    6,079
    How about you simply check when a client moves, and move them back then?
    Also since plugins are client side people could just disable their plugin and then move around freely.

    Code:
    void ts3plugin_onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage) {
        if (newChannelID != desiredChannelOfClient) {
            // Move Client back to desired channel
        }
    }
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  3. #18
    Join Date
    October 2014
    Posts
    60
    Good in theory but I'd like the client to stay in the same channel until they change the Frequency in the flight sim.

    For instance the client is talking in channel 118.750.
    ATC give them 123.450 to contact the next tower on route which they then input into their flight sim Radio meaning the variable FREQ changes.
    When the variable FREQ changes I'd like the client to move teamspeak channel to a channel name matching the variable FREQ.

    I would like Teamspeak to be minimised and running in the background so the pilot doesn't need to switch view to change teamspeak channel.
    The way you suggest above would mean they would have to change channel, but would then be moved back to where they were.

    Is that correct?

    Would "ts3plugin_onClientSelfVariableUpdateEvent" do what I'm thinking?

  4. #19
    Join Date
    September 2012
    Posts
    6,079
    It seems like you're overcomplicating / overthinking things.
    Since your plugin will communicate with the game through some channel in some form, your plugin will know when the user changed the frequency in the game. Whenever that happens (preferably the game API would inform you about that when it happens ie. be event based) you simply move the client to the channel in question.

    If all else fails you can always just check if the users current channel is the same as the target, and in case the client is already in the correct channel simply don't do anything. Of course doing that would result in a lot of unnecessary checks and function calls, which could possibly be avoided.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  5. #20
    Join Date
    October 2014
    Posts
    60
    Yes I probably am over thinking it and now I'm totally confussed.
    My game plugin with get the data I need and this can be accessed by teamspeak as FREQ.

    For testing purposes (until I get my game code together) I will define FREQ as "118.75"?

    And then test my TS code to see if it switches to a channel named 118.75 in different servers.

    How would I put this into the code you have helped me with?

  6. #21
    Join Date
    October 2014
    Posts
    60
    OK this is brilliant so far.

    Thank you all for your help especially Chris for supplying the code and all the help.
    I will publish this in the Teamspeak plugins section once I have completed it.

    One last question.
    My plugin looks for the channel name.
    I'm curious but could this be applied to the Phonetic name instead?

    Code:
    void ts3plugin_onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int status, int isReceivedWhisper, anyID clientID) {
    /*TEST INFO */
    		uint64 channelId = 0;
    		char *chpath[] = {"Air Traffic Control", FREQ, ""}; // Channel Structure
    		// Get the ID from the name
    		if (ts3Functions.getChannelIDFromChannelNames(serverConnectionHandlerID, chpath, &channelId) == ERROR_ok && channelId > 0) {
    			anyID myId = 0;
    			ts3Functions.getClientID(serverConnectionHandlerID, &myId);
    			if (myId > 0)
    				ts3Functions.requestClientMove(serverConnectionHandlerID, myId, channelId, "", NULL);
    		}
    		/* TEST INFO END */
    Last edited by ATC_ROO; February 14th, 2015 at 05:26 PM.

  7. #22
    Join Date
    October 2014
    Posts
    60
    Just an update for anybody interested in this plugin (moving channels when frequencies are selected in FSX).

    I have a working example **HOORAH!*

    Thank you to everybody that has helped here on Teamspeak and I will post the completed plugin when it's finalised.

    I can't go without asking another question though.

    I can't seem to create a Hotkey.

    I would like to define a Hotkey in the Teamspeak Hotkeys section so that when it is pressed it will switch to the channel.

    I disgarded the "ts3plugin_onTalkStatusChangeEvent" as it was generating the "already member of channel" everytime I hit the PTT.

    So i opted for the "ts3plugin_onClientMoveEvent" as suggested above and defined a hot key to move to next channel which subsequently moved me to my desired channel but.

    I have tried
    void ts3plugin_onHotkeyEvent(const char* keyword) {
    /*Start Channel Switch */
    if (NULL == hSimConnect) StartSimConnect();
    uint64 channelId = 0;
    sprintf_s(FREQ, "%3.3f", GetCom1());
    char *chpath[] = {"Air Traffic Control", FREQ, ""}; // Channel Structure
    anyID myId = 0;
    // Get the ID from the name
    if (ts3Functions.getChannelIDFromChannelNames(serverC onnectionHandlerID, chpath, &channelId) == ERROR_ok && channelId > 0) {
    ts3Functions.getClientID(serverConnectionHandlerID , &myId);
    if (myId = clientID)
    ts3Functions.requestClientMove(serverConnectionHan dlerID, myId, channelId, "", NULL);
    }

    /* End Channel Switch */
    }

    But this didn't seem to work.
    Any ideas why?

  8. #23
    Join Date
    October 2012
    Location
    Germany
    Posts
    553
    Well, the first thing hitting my eye would be
    Code:
    if (myId = clientID)
    ->
    Code:
    if (myId == clientID)
    Note that your code doesn't state what clientID actually is supposed to be, so I dunno what that comparison shall do.

  9. #24
    Join Date
    October 2014
    Posts
    60
    sorry try this.
    void ts3plugin_onHotkeyEvent(uint64 serverConnectionHandlerID, const char* keyword) {
    /*Start Channel Switch */
    if (NULL == hSimConnect) StartSimConnect();
    uint64 channelId = 0;
    sprintf_s(FREQ, "%3.3f", GetCom1());
    char *chpath[] = {"Air Traffic Control", FREQ, ""}; // Channel Structure

    anyID myId = 0;
    // Get the ID from the name
    if (ts3Functions.getChannelIDFromChannelNames(serverC onnectionHandlerID, chpath, &channelId) == ERROR_ok && channelId > 0) {
    ts3Functions.getClientID(serverConnectionHandlerID , &myId);
    if (myId > 0)
    ts3Functions.requestClientMove(serverConnectionHan dlerID, myId, channelId, "", NULL);
    }
    }
    Last edited by ATC_ROO; February 19th, 2015 at 05:39 AM.

  10. #25
    Join Date
    October 2012
    Location
    Germany
    Posts
    553
    Given that anyID is an unsigned int16, it's rather impossible for it to be negative.
    Code:
    if (myId>0)

  11. #26
    Join Date
    October 2014
    Posts
    60
    HA HA yes I just spotted that.

    It was a typo here on the forums and the code does state myId is greater than 0.
    Last edited by ATC_ROO; February 28th, 2015 at 07:40 PM.

  12. #27
    Join Date
    October 2014
    Posts
    60
    Thank you to everybody for all the help.

    My Plugin is now available here if anybody would like it.

    At this time the Plugin will work with the 32bit Client only as I need to change a few things to compile it for 64bit.

    The plugin will let you automatically change channels in TS3 when frequencies are selected on your Flight Sim Radio.
    This plugin works with FSX Steam, FSX Boxed and in theory P3D although not owning P3D I've been unable to test it.

    I would like to add it to the Addons section but it seems it's going through an upgrade, is that correct?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 7
    Last Post: July 23rd, 2014, 02:38 PM
  2. [suggestion]move user to own channel for channel admin
    By El_makong in forum Suggestions and Feedback
    Replies: 3
    Last Post: November 9th, 2013, 09:26 AM
  3. Replies: 4
    Last Post: June 18th, 2013, 05:37 PM
  4. Replies: 1
    Last Post: May 15th, 2013, 10:06 AM
  5. [Rejected] Move menu option for "Move client to own channel"
    By maggy in forum Suggestions and Feedback
    Replies: 1
    Last Post: March 23rd, 2013, 07:22 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
  •