Advertisement
Guest User

TSViewer

a guest
Nov 14th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.19 KB | None | 0 0
  1. -- written by https://github.com/r3n3pde
  2.  
  3. -- Author: René Preuß
  4. -- Website: http://renepreuss.net
  5.  
  6. -- Installation:
  7. -- Go to your Teamspeak program folder -> plugins -> lua_plugin
  8. -- Create a new folder, rename it to "TSViewer"
  9. -- Put this init.lua file in the "TSViewer" folder
  10. -- Adjust user config below to your needs
  11. -- Start Teamspeak, make sure the lua plugin is enabled in options->plugins
  12. -- Enter the plugin settings, enable the TSViewer script
  13.  
  14. -- Copyright (c) 2014 René Preuß
  15. -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  16.  
  17. -- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  18.  
  19. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20.  
  21. require("ts3init")
  22. require("ts3defs")
  23. require("ts3errors")
  24.  
  25.  
  26. function setContains(set, key)
  27.     return set[key] ~= nil
  28. end
  29.  
  30. function updateTxt(serverConnectionHandlerID, clientID, channelID)
  31.     local name = ts3.getClientVariableAsString(serverConnectionHandlerID, clientID, ts3defs.ClientProperties.CLIENT_NICKNAME)
  32.     local channelID = ts3.getChannelOfClient(serverConnectionHandlerID, clientID)
  33.     local ownID = ts3.getClientID(serverConnectionHandlerID)
  34.     local ownChannel = ts3.getChannelOfClient(serverConnectionHandlerID, ownID)
  35.     local clientList = ts3.getChannelClientList(serverConnectionHandlerID, ownChannel)
  36.     local file = io.open(os.getenv('APPDATA') .. "/TSViewer/TSViewer.txt", "w")
  37.        
  38.     io.output(file)
  39.    
  40.     if (channelID == ownChannel) then
  41.         local channelName = ts3.getChannelVariableAsString(serverConnectionHandlerID, ownChannel, ts3defs.ChannelProperties.CHANNEL_NAME)
  42.         io.write("".. channelName .."\n")
  43.         for i=1, #clientList do
  44.             local tempClientId = clientList[i]
  45.             local tempClientName = ts3.getClientVariableAsString(serverConnectionHandlerID, tempClientId, ts3defs.ClientProperties.CLIENT_NICKNAME)
  46.             io.write("".. tempClientName .."\n")
  47.         end
  48.        
  49.     else io.write("Fail")  
  50.     end
  51.     io.close()
  52. end
  53.  
  54. function onClientMoveEvent(serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, moveMessage)
  55.     updateTxt(serverConnectionHandlerID, clientID, newChannelID)
  56. end
  57.  
  58. --function onTalkStatusChangeEvent(serverConnectionHandlerID, status, isReceivedWhisper, clientID)
  59. --local name = ts3.getClientVariableAsString(serverConnectionHandlerID, clientID, ts3defs.ClientProperties.CLIENT_NICKNAME)
  60. --  local channelID = ts3.getChannelOfClient(serverConnectionHandlerID, clientID)
  61. --  local clientList = ts3.getChannelClientList(serverConnectionHandlerID, channelID)
  62. --  local file = io.open(os.getenv('APPDATA') .. "/TSViewer/TSViewer.txt", "w")
  63. -- 
  64. --     
  65. --  io.output(file)
  66. -- 
  67. --  local channelName = ts3.getChannelVariableAsString(serverConnectionHandlerID, channelID, ts3defs.ChannelProperties.CHANNEL_NAME)
  68. --
  69. --  io.write("".. channelName .."\n")
  70. --
  71. --  for i=1, #clientList do
  72. --      local tempClientId = clientList[i]
  73. --      local tempClientName = ts3.getClientVariableAsString(serverConnectionHandlerID, tempClientId, ts3defs.ClientProperties.CLIENT_NICKNAME)
  74. --      io.write("".. tempClientName .."\n")
  75. --  end
  76. -- 
  77. --  io.close()
  78. --end
  79.  
  80. local registeredEvents = {
  81. --  ["onTalkStatusChangeEvent"] = onTalkStatusChangeEvent
  82.     ["onClientMoveEvent"] = onClientMoveEvent
  83. }
  84. ts3RegisterModule(MODULE_NAME, registeredEvents)
  85.  
  86. -- test
  87. notifier = {}
  88. notifier.test = function(serverConnectionHandlerID)
  89.     onClientMoveEvent(serverConnectionHandlerID,23,0,1,1,"Move It.")
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement