Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.62 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. local MODULE_NAME = "TSViewer"
  26.  
  27. function setContains(set, key)
  28.     return set[key] ~= nil
  29. end
  30.  
  31. function onClientMoveEvent(serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, moveMessage)
  32.     local name = ts3.getClientVariableAsString(serverConnectionHandlerID, clientID, ts3defs.ClientProperties.CLIENT_NICKNAME)
  33.     local channelID = ts3.getChannelOfClient(serverConnectionHandlerID, clientID)
  34.     local ownID = ts3.getClientID(serverConnectionHandlerID)
  35.     local ownChannel = ts3.getChannelOfClient(serverConnectionHandlerID, ownID)
  36.     local clientList = ts3.getChannelClientList(serverConnectionHandlerID, ownChannel)
  37.     local channelName = ts3.getChannelVariableAsString(serverConnectionHandlerID, channelID, ts3defs.ChannelProperties.CHANNEL_NAME)
  38.     local ownChannelName = ts3.getChannelVariableAsString(serverConnectionHandlerID, ownChannel, ts3defs.ChannelProperties.CHANNEL_NAME)
  39.    
  40.     if channelID == ownChannel then
  41.         local file = io.open(os.getenv('APPDATA') .. "/TSViewer/TSViewer.txt", "w")
  42.         io.output(file)
  43.         io.write("".. channelName .."\n")
  44.         for i=1, #clientList do
  45.             local tempClientId = clientList[i]
  46.             local tempClientName = ts3.getClientVariableAsString(serverConnectionHandlerID, tempClientId, ts3defs.ClientProperties.CLIENT_NICKNAME)
  47.             io.write("".. tempClientName .."\n")
  48.         end
  49.     else
  50.         local file = io.open(os.getenv('APPDATA') .. "/TSViewer/TSViewer.txt", "w")
  51.         io.output(file)
  52.         io.write("".. ownChannelName .."\n")
  53.         for i=1, #clientList do
  54.             local tempClientId = clientList[i]
  55.             local tempClientName = ts3.getClientVariableAsString(serverConnectionHandlerID, tempClientId, ts3defs.ClientProperties.CLIENT_NICKNAME)
  56.             io.write("".. tempClientName .."\n")
  57.         end
  58.     end
  59.     io.close()
  60. end
  61.  
  62. local registeredEvents = {
  63.     ["onClientMoveEvent"] = onClientMoveEvent
  64. }
  65. ts3RegisterModule(MODULE_NAME, registeredEvents)
  66.  
  67. --  ["onTalkStatusChangeEvent"] = onTalkStatusChangeEvent
  68. -- test
  69. notifier = {}
  70. notifier.test = function(serverConnectionHandlerID)
  71.     onClientMoveEvent(serverConnectionHandlerID,23,0,1,1,"Move It.")
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement